diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 4c8323b..411d309 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -1,78 +1,78 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Array Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/array_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Element
- *
- * Lets you determine whether an array index is set and whether it has a value.
- * If the element is empty it returns FALSE (or whatever you specify as the default value.)
- *
- * @access	public
- * @param	string
- * @param	array
- * @param	mixed
- * @return	mixed	depends on what the array contains
- */	
-if ( ! function_exists('element'))
-{
-	function element($item, $array, $default = FALSE)
-	{
-		if ( ! isset($array[$item]) OR $array[$item] == "")
-		{
-			return $default;
-		}
-
-		return $array[$item];
-	}	
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Random Element - Takes an array as input and returns a random element
- *
- * @access	public
- * @param	array
- * @return	mixed	depends on what the array contains
- */	
-if ( ! function_exists('random_element'))
-{
-	function random_element($array)
-	{
-		if ( ! is_array($array))
-		{
-			return $array;
-		}
-		return $array[array_rand($array)];
-	}	
-}
-
-
-/* End of file array_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Array Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/array_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Element
+ *
+ * Lets you determine whether an array index is set and whether it has a value.
+ * If the element is empty it returns FALSE (or whatever you specify as the default value.)
+ *
+ * @access	public
+ * @param	string
+ * @param	array
+ * @param	mixed
+ * @return	mixed	depends on what the array contains
+ */	
+if ( ! function_exists('element'))
+{
+	function element($item, $array, $default = FALSE)
+	{
+		if ( ! isset($array[$item]) OR $array[$item] == "")
+		{
+			return $default;
+		}
+
+		return $array[$item];
+	}	
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Random Element - Takes an array as input and returns a random element
+ *
+ * @access	public
+ * @param	array
+ * @return	mixed	depends on what the array contains
+ */	
+if ( ! function_exists('random_element'))
+{
+	function random_element($array)
+	{
+		if ( ! is_array($array))
+		{
+			return $array;
+		}
+		return $array[array_rand($array)];
+	}	
+}
+
+
+/* End of file array_helper.php */
 /* Location: ./system/helpers/array_helper.php */
\ No newline at end of file
diff --git a/system/helpers/compatibility_helper.php b/system/helpers/compatibility_helper.php
index 996a6d7..3b37cea 100644
--- a/system/helpers/compatibility_helper.php
+++ b/system/helpers/compatibility_helper.php
@@ -1,498 +1,498 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Compatibility Helpers
- *
- * This helper contains some functions based on the PEAR PHP_Compat library
- * http://pear.php.net/package/PHP_Compat
- * 
- * The PEAR compat library is a little bloated and the code doesn't harmonize
- * well with CodeIgniter, so those functions have been refactored.
- * We cheat a little and use CI's _exception_handler() to output our own PHP errors
- * so that the behavior fully mimicks the PHP 5 counterparts.  -- Derek Jones
- * 
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/compatibility_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-if ( ! defined('PHP_EOL'))
-{
-	define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n");
-} 
-
-// ------------------------------------------------------------------------
-
-/**
- * file_put_contents()
- *
- * Writes a string to a file
- * http://us.php.net/manual/en/function.file_put_contents.php
- * argument 4, $context, not supported
- *
- * @access	public
- * @param	string		file name
- * @param	mixed		data to be written
- * @param	int			flags
- * @return	int			length of written string
- */
-if ( ! function_exists('file_put_contents'))
-{
-	function file_put_contents($filename, $data, $flags = NULL)
-	{
-		if (is_scalar($data))
-		{
-			settype($data, 'STRING');
-		}
-
-		if ( ! is_string($data) && ! is_array($data) && ! is_resource($data))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-
-		// read stream if given a stream resource
-		if (is_resource($data))
-		{
-			if (get_resource_type($data) !== 'stream')
-			{
-				$backtrace = debug_backtrace();
-				_exception_handler(E_USER_WARNING, 'file_put_contents(): supplied resource is not a valid stream resource', $backtrace[0]['file'], $backtrace[0]['line']);
-				return FALSE;
-			}
-
-			$text = '';
-			
-			while ( ! feof($data))
-			{
-				$text .= fread($data, 4096);
-			}
-			
-			$data = $text;
-			unset($text);
-		}
-	
-		// strings only please!
-		if (is_array($data))
-		{
-			$data = implode('', $data);
-		}
-
-		// Set the appropriate mode
-		if (($flags & 8) > 0) // 8 = FILE_APPEND flag
-		{
-			$mode = FOPEN_WRITE_CREATE;
-		}
-		else
-		{
-			$mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
-		}
-	
-		// Check if we're using the include path
-		if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag
-		{
-			$use_include_path = TRUE;
-		}
-		else
-		{
-			$use_include_path = FALSE;
-		}
-	
-		$fp = @fopen($filename, $mode, $use_include_path);
-	
-		if ($fp === FALSE)
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		if (($flags & LOCK_EX) > 0)
-		{
-			if ( ! flock($fp, LOCK_EX))
-			{
-				$backtrace = debug_backtrace();
-				_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']);
-				return FALSE;
-			}
-		}
-		
-		// write it
-		if (($written = @fwrite($fp, $data)) === FALSE)
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
-		}
-	
-		// Close the handle
-		@fclose($fp);
-	
-		// Return length
-		return $written;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * fputcsv()
- *
- * Format line as CSV and write to file pointer
- * http://us.php.net/manual/en/function.fputcsv.php
- *
- * @access	public
- * @param	resource	file pointer
- * @param	array		data to be written
- * @param	string		delimiter
- * @param	string		enclosure
- * @return	int			length of written string
- */
-if ( ! function_exists('fputcsv'))
-{
-	function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"')
-	{
-		// Checking for a handle resource
-		if ( ! is_resource($handle))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		// OK, it is a resource, but is it a stream?
-		if (get_resource_type($handle) !== 'stream')
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		// Checking for an array of fields
-		if ( ! is_array($fields))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		// validate delimiter
-		if (strlen($delimiter) > 1)
-		{
-			$delimiter = substr($delimiter, 0, 1);
-			$backtrace = debug_backtrace();
-			_exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
-		}
-	
-		// validate enclosure
-		if (strlen($enclosure) > 1)
-		{
-			$enclosure = substr($enclosure, 0, 1);
-			$backtrace = debug_backtrace();
-			_exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
-
-		}
-	
-		$out = '';
-	
-		foreach ($fields as $cell)
-		{
-			$cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
-
-			if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE)
-			{
-				$out .= $enclosure.$cell.$enclosure.$delimiter;
-			}
-			else
-			{
-				$out .= $cell.$delimiter;
-			}
-		}
-	
-		$length = @fwrite($handle, substr($out, 0, -1)."\n");
-	
-		return $length;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * stripos()
- *
- * Find position of first occurrence of a case-insensitive string
- * http://us.php.net/manual/en/function.stripos.php
- *
- * @access	public
- * @param	string		haystack
- * @param	string		needle
- * @param	int			offset
- * @return	int			numeric position of the first occurrence of needle in the haystack
- */
-if ( ! function_exists('stripos'))
-{
-	function stripos($haystack, $needle, $offset = NULL)
-	{
-		// Cast non string scalar values
-		if (is_scalar($haystack))
-		{
-			settype($haystack, 'STRING');
-		}
-	
-		if ( ! is_string($haystack))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		if ( ! is_scalar($needle))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		if (is_float($offset))
-		{
-			$offset = (int)$offset;
-		}
-	
-		if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return NULL;
-		}
-	
-		return strpos(strtolower($haystack), strtolower($needle), $offset);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * str_ireplace()
- *
- * Find position of first occurrence of a case-insensitive string
- * http://us.php.net/manual/en/function.str-ireplace.php
- * (parameter 4, $count, is not supported as to do so in PHP 4 would make
- * it a required parameter)
- *
- * @access	public
- * @param	mixed		search
- * @param	mixed		replace
- * @param	mixed		subject
- * @return	int			numeric position of the first occurrence of needle in the haystack
- */
-if ( ! function_exists('str_ireplace'))
-{
-	function str_ireplace($search, $replace, $subject)
-	{
-		// Nothing to do here
-		if ($search === NULL OR $subject === NULL)
-		{
-			return $subject;
-		}
-	
-		// Crazy arguments
-		if (is_scalar($search) && is_array($replace))
-		{
-			$backtrace = debug_backtrace();
-
-			if (is_object($replace))
-			{
-				show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']);
-			}
-			else
-			{
-				_exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
-			}
-		}
-	
-		// Searching for an array
-		if (is_array($search))
-		{
-			// Replacing with an array
-			if (is_array($replace))
-			{
-				$search = array_values($search);
-				$replace = array_values($replace);
-
-				if (count($search) >= count($replace))
-				{
-					$replace = array_pad($replace, count($search), '');
-				}
-				else
-				{
-					$replace = array_slice($replace, 0, count($search));
-				}
-			}
-			else
-			{
-				// Replacing with a string all positions
-				$replace = array_fill(0, count($search), $replace);
-			}
-		}
-		else
-		{
-			//Searching for a string and replacing with a string.
-			$search  = array((string)$search);
-			$replace = array((string)$replace);
-		}
-		
-		// Prepare the search array
-		foreach ($search as $search_key => $search_value)
-		{
-			$search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
-		}
-		
-		// Prepare the replace array (escape backreferences)
-		foreach ($replace as $k => $v)
-		{
-			$replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
-		}
-	
-		// do the replacement
-		$result = preg_replace($search, $replace, (array)$subject);
-	
-		// Check if subject was initially a string and return it as a string
-		if ( ! is_array($subject))
-		{
-			return current($result);
-		}
-	
-		// Otherwise, just return the array
-		return $result;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * http_build_query()
- *
- * Generate URL-encoded query string
- * http://us.php.net/manual/en/function.http-build-query.php
- *
- * @access	public
- * @param	array		form data
- * @param	string		numeric prefix
- * @param	string		argument separator
- * @return	string		URL-encoded string
- */
-if ( ! function_exists('http_build_query'))
-{
-	function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
-	{
-		// Check the data
-		if ( ! is_array($formdata) && ! is_object($formdata))
-		{
-			$backtrace = debug_backtrace();
-			_exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
-			return FALSE;
-		}
-	
-		// Cast it as array
-		if (is_object($formdata))
-		{
-			$formdata = get_object_vars($formdata);
-		}
-	
-		// If the array is empty, return NULL
-		if (empty($formdata))
-		{
-			return NULL;
-		}
-	
-		// Argument separator
-		if ($separator === NULL)
-		{
-			$separator = ini_get('arg_separator.output');
-
-			if (strlen($separator) == 0)
-			{
-				$separator = '&';
-			}
-		}
-	
-		// Start building the query
-		$tmp = array();
-
-		foreach ($formdata as $key => $val)
-		{
-			if ($val === NULL)
-			{
-				continue;
-			}
-	
-			if (is_integer($key) && $numeric_prefix != NULL)
-			{
-				$key = $numeric_prefix.$key;
-			}
-	
-			if (is_resource($val))
-			{
-				return NULL;
-			}
-			
-			// hand it off to a recursive parser
-			$tmp[] = _http_build_query_helper($key, $val, $separator);
-		}
-	
-		return implode($separator, $tmp);
-	}
-	
-	
-	// Helper helper.  Remind anyone of college?
-	// Required to handle recursion in nested arrays.
-	// 
-	// You could shave fractions of fractions of a second by moving where
-	// the urlencoding takes place, but it's much less intuitive, and if
-	// your application has 10,000 form fields, well, you have other problems ;)
-	function _http_build_query_helper($key, $val, $separator = '&')
-	{	
-		if (is_scalar($val))
-		{
-			return urlencode($key).'='.urlencode($val);			
-		}
-		else
-		{
-			// arrays please
-			if (is_object($val))
-			{
-				$val = get_object_vars($val);
-			}
-			
-			foreach ($val as $k => $v)
-			{
-				$tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
-			}
-		}
-			
-		return implode($separator, $tmp);
-	}
-}
-
-
-/* End of file compatibility_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Compatibility Helpers
+ *
+ * This helper contains some functions based on the PEAR PHP_Compat library
+ * http://pear.php.net/package/PHP_Compat
+ * 
+ * The PEAR compat library is a little bloated and the code doesn't harmonize
+ * well with CodeIgniter, so those functions have been refactored.
+ * We cheat a little and use CI's _exception_handler() to output our own PHP errors
+ * so that the behavior fully mimicks the PHP 5 counterparts.  -- Derek Jones
+ * 
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/compatibility_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+if ( ! defined('PHP_EOL'))
+{
+	define('PHP_EOL', (DIRECTORY_SEPARATOR == '/') ? "\n" : "\r\n");
+} 
+
+// ------------------------------------------------------------------------
+
+/**
+ * file_put_contents()
+ *
+ * Writes a string to a file
+ * http://us.php.net/manual/en/function.file_put_contents.php
+ * argument 4, $context, not supported
+ *
+ * @access	public
+ * @param	string		file name
+ * @param	mixed		data to be written
+ * @param	int			flags
+ * @return	int			length of written string
+ */
+if ( ! function_exists('file_put_contents'))
+{
+	function file_put_contents($filename, $data, $flags = NULL)
+	{
+		if (is_scalar($data))
+		{
+			settype($data, 'STRING');
+		}
+
+		if ( ! is_string($data) && ! is_array($data) && ! is_resource($data))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'file_put_contents(): the 2nd parameter should be either a string or an array', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+
+		// read stream if given a stream resource
+		if (is_resource($data))
+		{
+			if (get_resource_type($data) !== 'stream')
+			{
+				$backtrace = debug_backtrace();
+				_exception_handler(E_USER_WARNING, 'file_put_contents(): supplied resource is not a valid stream resource', $backtrace[0]['file'], $backtrace[0]['line']);
+				return FALSE;
+			}
+
+			$text = '';
+			
+			while ( ! feof($data))
+			{
+				$text .= fread($data, 4096);
+			}
+			
+			$data = $text;
+			unset($text);
+		}
+	
+		// strings only please!
+		if (is_array($data))
+		{
+			$data = implode('', $data);
+		}
+
+		// Set the appropriate mode
+		if (($flags & 8) > 0) // 8 = FILE_APPEND flag
+		{
+			$mode = FOPEN_WRITE_CREATE;
+		}
+		else
+		{
+			$mode = FOPEN_WRITE_CREATE_DESTRUCTIVE;
+		}
+	
+		// Check if we're using the include path
+		if (($flags & 1) > 0) // 1 = FILE_USE_INCLUDE_PATH flag
+		{
+			$use_include_path = TRUE;
+		}
+		else
+		{
+			$use_include_path = FALSE;
+		}
+	
+		$fp = @fopen($filename, $mode, $use_include_path);
+	
+		if ($fp === FALSE)
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to open stream', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		if (($flags & LOCK_EX) > 0)
+		{
+			if ( ! flock($fp, LOCK_EX))
+			{
+				$backtrace = debug_backtrace();
+				_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') unable to acquire an exclusive lock on file', $backtrace[0]['file'], $backtrace[0]['line']);
+				return FALSE;
+			}
+		}
+		
+		// write it
+		if (($written = @fwrite($fp, $data)) === FALSE)
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'file_put_contents('.htmlentities($filename).') failed to write to '.htmlentities($filename), $backtrace[0]['file'], $backtrace[0]['line']);
+		}
+	
+		// Close the handle
+		@fclose($fp);
+	
+		// Return length
+		return $written;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * fputcsv()
+ *
+ * Format line as CSV and write to file pointer
+ * http://us.php.net/manual/en/function.fputcsv.php
+ *
+ * @access	public
+ * @param	resource	file pointer
+ * @param	array		data to be written
+ * @param	string		delimiter
+ * @param	string		enclosure
+ * @return	int			length of written string
+ */
+if ( ! function_exists('fputcsv'))
+{
+	function fputcsv($handle, $fields, $delimiter = ',', $enclosure = '"')
+	{
+		// Checking for a handle resource
+		if ( ! is_resource($handle))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.gettype($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		// OK, it is a resource, but is it a stream?
+		if (get_resource_type($handle) !== 'stream')
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 1 to be stream resource, '.get_resource_type($handle).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		// Checking for an array of fields
+		if ( ! is_array($fields))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'fputcsv() expects parameter 2 to be array, '.gettype($fields).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		// validate delimiter
+		if (strlen($delimiter) > 1)
+		{
+			$delimiter = substr($delimiter, 0, 1);
+			$backtrace = debug_backtrace();
+			_exception_handler(E_NOTICE, 'fputcsv() delimiter must be one character long, "'.htmlentities($delimiter).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
+		}
+	
+		// validate enclosure
+		if (strlen($enclosure) > 1)
+		{
+			$enclosure = substr($enclosure, 0, 1);
+			$backtrace = debug_backtrace();
+			_exception_handler(E_NOTICE, 'fputcsv() enclosure must be one character long, "'.htmlentities($enclosure).'" used', $backtrace[0]['file'], $backtrace[0]['line']);
+
+		}
+	
+		$out = '';
+	
+		foreach ($fields as $cell)
+		{
+			$cell = str_replace($enclosure, $enclosure.$enclosure, $cell);
+
+			if (strpos($cell, $delimiter) !== FALSE OR strpos($cell, $enclosure) !== FALSE OR strpos($cell, "\n") !== FALSE)
+			{
+				$out .= $enclosure.$cell.$enclosure.$delimiter;
+			}
+			else
+			{
+				$out .= $cell.$delimiter;
+			}
+		}
+	
+		$length = @fwrite($handle, substr($out, 0, -1)."\n");
+	
+		return $length;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * stripos()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.stripos.php
+ *
+ * @access	public
+ * @param	string		haystack
+ * @param	string		needle
+ * @param	int			offset
+ * @return	int			numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('stripos'))
+{
+	function stripos($haystack, $needle, $offset = NULL)
+	{
+		// Cast non string scalar values
+		if (is_scalar($haystack))
+		{
+			settype($haystack, 'STRING');
+		}
+	
+		if ( ! is_string($haystack))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'stripos() expects parameter 1 to be string, '.gettype($haystack).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		if ( ! is_scalar($needle))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'stripos() needle is not a string or an integer in '.$backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		if (is_float($offset))
+		{
+			$offset = (int)$offset;
+		}
+	
+		if ( ! is_int($offset) && ! is_bool($offset) && ! is_null($offset))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'stripos() expects parameter 3 to be long, '.gettype($offset).' given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return NULL;
+		}
+	
+		return strpos(strtolower($haystack), strtolower($needle), $offset);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * str_ireplace()
+ *
+ * Find position of first occurrence of a case-insensitive string
+ * http://us.php.net/manual/en/function.str-ireplace.php
+ * (parameter 4, $count, is not supported as to do so in PHP 4 would make
+ * it a required parameter)
+ *
+ * @access	public
+ * @param	mixed		search
+ * @param	mixed		replace
+ * @param	mixed		subject
+ * @return	int			numeric position of the first occurrence of needle in the haystack
+ */
+if ( ! function_exists('str_ireplace'))
+{
+	function str_ireplace($search, $replace, $subject)
+	{
+		// Nothing to do here
+		if ($search === NULL OR $subject === NULL)
+		{
+			return $subject;
+		}
+	
+		// Crazy arguments
+		if (is_scalar($search) && is_array($replace))
+		{
+			$backtrace = debug_backtrace();
+
+			if (is_object($replace))
+			{
+				show_error('Object of class '.get_class($replace).' could not be converted to string in '.$backtrace[0]['file'].' on line '.$backtrace[0]['line']);
+			}
+			else
+			{
+				_exception_handler(E_USER_NOTICE, 'Array to string conversion in '.$backtrace[0]['file'], $backtrace[0]['line']);
+			}
+		}
+	
+		// Searching for an array
+		if (is_array($search))
+		{
+			// Replacing with an array
+			if (is_array($replace))
+			{
+				$search = array_values($search);
+				$replace = array_values($replace);
+
+				if (count($search) >= count($replace))
+				{
+					$replace = array_pad($replace, count($search), '');
+				}
+				else
+				{
+					$replace = array_slice($replace, 0, count($search));
+				}
+			}
+			else
+			{
+				// Replacing with a string all positions
+				$replace = array_fill(0, count($search), $replace);
+			}
+		}
+		else
+		{
+			//Searching for a string and replacing with a string.
+			$search  = array((string)$search);
+			$replace = array((string)$replace);
+		}
+		
+		// Prepare the search array
+		foreach ($search as $search_key => $search_value)
+		{
+			$search[$search_key] = '/'.preg_quote($search_value, '/').'/i';
+		}
+		
+		// Prepare the replace array (escape backreferences)
+		foreach ($replace as $k => $v)
+		{
+			$replace[$k] = str_replace(array(chr(92), '$'), array(chr(92).chr(92), '\$'), $v);
+		}
+	
+		// do the replacement
+		$result = preg_replace($search, $replace, (array)$subject);
+	
+		// Check if subject was initially a string and return it as a string
+		if ( ! is_array($subject))
+		{
+			return current($result);
+		}
+	
+		// Otherwise, just return the array
+		return $result;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * http_build_query()
+ *
+ * Generate URL-encoded query string
+ * http://us.php.net/manual/en/function.http-build-query.php
+ *
+ * @access	public
+ * @param	array		form data
+ * @param	string		numeric prefix
+ * @param	string		argument separator
+ * @return	string		URL-encoded string
+ */
+if ( ! function_exists('http_build_query'))
+{
+	function http_build_query($formdata, $numeric_prefix = NULL, $separator = NULL)
+	{
+		// Check the data
+		if ( ! is_array($formdata) && ! is_object($formdata))
+		{
+			$backtrace = debug_backtrace();
+			_exception_handler(E_USER_WARNING, 'http_build_query() Parameter 1 expected to be Array or Object. Incorrect value given', $backtrace[0]['file'], $backtrace[0]['line']);
+			return FALSE;
+		}
+	
+		// Cast it as array
+		if (is_object($formdata))
+		{
+			$formdata = get_object_vars($formdata);
+		}
+	
+		// If the array is empty, return NULL
+		if (empty($formdata))
+		{
+			return NULL;
+		}
+	
+		// Argument separator
+		if ($separator === NULL)
+		{
+			$separator = ini_get('arg_separator.output');
+
+			if (strlen($separator) == 0)
+			{
+				$separator = '&';
+			}
+		}
+	
+		// Start building the query
+		$tmp = array();
+
+		foreach ($formdata as $key => $val)
+		{
+			if ($val === NULL)
+			{
+				continue;
+			}
+	
+			if (is_integer($key) && $numeric_prefix != NULL)
+			{
+				$key = $numeric_prefix.$key;
+			}
+	
+			if (is_resource($val))
+			{
+				return NULL;
+			}
+			
+			// hand it off to a recursive parser
+			$tmp[] = _http_build_query_helper($key, $val, $separator);
+		}
+	
+		return implode($separator, $tmp);
+	}
+	
+	
+	// Helper helper.  Remind anyone of college?
+	// Required to handle recursion in nested arrays.
+	// 
+	// You could shave fractions of fractions of a second by moving where
+	// the urlencoding takes place, but it's much less intuitive, and if
+	// your application has 10,000 form fields, well, you have other problems ;)
+	function _http_build_query_helper($key, $val, $separator = '&')
+	{	
+		if (is_scalar($val))
+		{
+			return urlencode($key).'='.urlencode($val);			
+		}
+		else
+		{
+			// arrays please
+			if (is_object($val))
+			{
+				$val = get_object_vars($val);
+			}
+			
+			foreach ($val as $k => $v)
+			{
+				$tmp[] = _http_build_query_helper($key.'['.$k.']', $v, $separator);
+			}
+		}
+			
+		return implode($separator, $tmp);
+	}
+}
+
+
+/* End of file compatibility_helper.php */
 /* Location: ./system/helpers/compatibility_helper.php */
\ No newline at end of file
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 61561b7..d906882 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -1,136 +1,136 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Cookie Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/cookie_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Set cookie
- *
- * Accepts six parameter, or you can submit an associative
- * array in the first parameter containing all the values.
- *
- * @access	public
- * @param	mixed
- * @param	string	the value of the cookie
- * @param	string	the number of seconds until expiration
- * @param	string	the cookie domain.  Usually:  .yourdomain.com
- * @param	string	the cookie path
- * @param	string	the cookie prefix
- * @return	void
- */
-if ( ! function_exists('set_cookie'))
-{
-	function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
-	{
-		if (is_array($name))
-		{		
-			foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item)
-			{
-				if (isset($name[$item]))
-				{
-					$$item = $name[$item];
-				}
-			}
-		}
-	
-		// Set the config file options
-		$CI =& get_instance();
-	
-		if ($prefix == '' AND $CI->config->item('cookie_prefix') != '')
-		{
-			$prefix = $CI->config->item('cookie_prefix');
-		}
-		if ($domain == '' AND $CI->config->item('cookie_domain') != '')
-		{
-			$domain = $CI->config->item('cookie_domain');
-		}
-		if ($path == '/' AND $CI->config->item('cookie_path') != '/')
-		{
-			$path = $CI->config->item('cookie_path');
-		}
-		
-		if ( ! is_numeric($expire))
-		{
-			$expire = time() - 86500;
-		}
-		else
-		{
-			if ($expire > 0)
-			{
-				$expire = time() + $expire;
-			}
-			else
-			{
-				$expire = 0;
-			}
-		}
-	
-		setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
-	}
-}
-	
-// --------------------------------------------------------------------
-
-/**
- * Fetch an item from the COOKIE array
- *
- * @access	public
- * @param	string
- * @param	bool
- * @return	mixed
- */
-if ( ! function_exists('get_cookie'))
-{
-	function get_cookie($index = '', $xss_clean = FALSE)
-	{
-		$CI =& get_instance();
-		return $CI->input->cookie($index, $xss_clean);
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Delete a COOKIE
- *
- * @param	mixed
- * @param	string	the cookie domain.  Usually:  .yourdomain.com
- * @param	string	the cookie path
- * @param	string	the cookie prefix
- * @return	void
- */
-if ( ! function_exists('delete_cookie'))
-{
-	function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
-	{
-		set_cookie($name, '', '', $domain, $path, $prefix);
-	}
-}
-
-
-/* End of file cookie_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Cookie Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/cookie_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set cookie
+ *
+ * Accepts six parameter, or you can submit an associative
+ * array in the first parameter containing all the values.
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string	the value of the cookie
+ * @param	string	the number of seconds until expiration
+ * @param	string	the cookie domain.  Usually:  .yourdomain.com
+ * @param	string	the cookie path
+ * @param	string	the cookie prefix
+ * @return	void
+ */
+if ( ! function_exists('set_cookie'))
+{
+	function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
+	{
+		if (is_array($name))
+		{		
+			foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item)
+			{
+				if (isset($name[$item]))
+				{
+					$$item = $name[$item];
+				}
+			}
+		}
+	
+		// Set the config file options
+		$CI =& get_instance();
+	
+		if ($prefix == '' AND $CI->config->item('cookie_prefix') != '')
+		{
+			$prefix = $CI->config->item('cookie_prefix');
+		}
+		if ($domain == '' AND $CI->config->item('cookie_domain') != '')
+		{
+			$domain = $CI->config->item('cookie_domain');
+		}
+		if ($path == '/' AND $CI->config->item('cookie_path') != '/')
+		{
+			$path = $CI->config->item('cookie_path');
+		}
+		
+		if ( ! is_numeric($expire))
+		{
+			$expire = time() - 86500;
+		}
+		else
+		{
+			if ($expire > 0)
+			{
+				$expire = time() + $expire;
+			}
+			else
+			{
+				$expire = 0;
+			}
+		}
+	
+		setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
+	}
+}
+	
+// --------------------------------------------------------------------
+
+/**
+ * Fetch an item from the COOKIE array
+ *
+ * @access	public
+ * @param	string
+ * @param	bool
+ * @return	mixed
+ */
+if ( ! function_exists('get_cookie'))
+{
+	function get_cookie($index = '', $xss_clean = FALSE)
+	{
+		$CI =& get_instance();
+		return $CI->input->cookie($index, $xss_clean);
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Delete a COOKIE
+ *
+ * @param	mixed
+ * @param	string	the cookie domain.  Usually:  .yourdomain.com
+ * @param	string	the cookie path
+ * @param	string	the cookie prefix
+ * @return	void
+ */
+if ( ! function_exists('delete_cookie'))
+{
+	function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '')
+	{
+		set_cookie($name, '', '', $domain, $path, $prefix);
+	}
+}
+
+
+/* End of file cookie_helper.php */
 /* Location: ./system/helpers/cookie_helper.php */
\ No newline at end of file
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index c9c8968..dbd7e0e 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -1,611 +1,611 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Date Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/date_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Get "now" time
- *
- * Returns time() or its GMT equivalent based on the config file preference
- *
- * @access	public
- * @return	integer
- */	
-if ( ! function_exists('now'))
-{
-	function now()
-	{
-		$CI =& get_instance();
-	
-		if (strtolower($CI->config->item('time_reference')) == 'gmt')
-		{
-			$now = time();
-			$system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
-	
-			if (strlen($system_time) < 10)
-			{
-				$system_time = time();
-				log_message('error', 'The Date class could not set a proper GMT timestamp so the local time() value was used.');
-			}
-	
-			return $system_time;
-		}
-		else
-		{
-			return time();
-		}
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Convert MySQL Style Datecodes
- *
- * This function is identical to PHPs date() function,
- * except that it allows date codes to be formatted using
- * the MySQL style, where each code letter is preceded
- * with a percent sign:  %Y %m %d etc...
- *
- * The benefit of doing dates this way is that you don't
- * have to worry about escaping your text letters that
- * match the date codes.
- *
- * @access	public
- * @param	string
- * @param	integer
- * @return	integer
- */	
-if ( ! function_exists('mdate'))
-{
-	function mdate($datestr = '', $time = '')
-	{
-		if ($datestr == '')
-			return '';
-	
-		if ($time == '')
-			$time = now();
-		
-		$datestr = str_replace('%\\', '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr));
-		return date($datestr, $time);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Standard Date
- *
- * Returns a date formatted according to the submitted standard.
- *
- * @access	public
- * @param	string	the chosen format
- * @param	integer	Unix timestamp
- * @return	string
- */	
-if ( ! function_exists('standard_date'))
-{
-	function standard_date($fmt = 'DATE_RFC822', $time = '')
-	{
-		$formats = array(
-						'DATE_ATOM'		=>	'%Y-%m-%dT%H:%i:%s%Q',
-						'DATE_COOKIE'	=>	'%l, %d-%M-%y %H:%i:%s UTC',
-						'DATE_ISO8601'	=>	'%Y-%m-%dT%H:%i:%s%O',
-						'DATE_RFC822'	=>	'%D, %d %M %y %H:%i:%s %O',
-						'DATE_RFC850'	=>	'%l, %d-%M-%y %H:%m:%i UTC',
-						'DATE_RFC1036'	=>	'%D, %d %M %y %H:%i:%s %O',
-						'DATE_RFC1123'	=>	'%D, %d %M %Y %H:%i:%s %O',
-						'DATE_RSS'		=>	'%D, %d %M %Y %H:%i:%s %O',
-						'DATE_W3C'		=>	'%Y-%m-%dT%H:%i:%s%Q'
-						);
-
-		if ( ! isset($formats[$fmt]))
-		{
-			return FALSE;
-		}
-	
-		return mdate($formats[$fmt], $time);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Timespan
- *
- * Returns a span of seconds in this format:
- *	10 days 14 hours 36 minutes 47 seconds
- *
- * @access	public
- * @param	integer	a number of seconds
- * @param	integer	Unix timestamp
- * @return	integer
- */	
-if ( ! function_exists('timespan'))
-{
-	function timespan($seconds = 1, $time = '')
-	{
-		$CI =& get_instance();
-		$CI->lang->load('date');
-
-		if ( ! is_numeric($seconds))
-		{
-			$seconds = 1;
-		}
-	
-		if ( ! is_numeric($time))
-		{
-			$time = time();
-		}
-	
-		if ($time <= $seconds)
-		{
-			$seconds = 1;
-		}
-		else
-		{
-			$seconds = $time - $seconds;
-		}
-		
-		$str = '';
-		$years = floor($seconds / 31536000);
-	
-		if ($years > 0)
-		{	
-			$str .= $years.' '.$CI->lang->line((($years	> 1) ? 'date_years' : 'date_year')).', ';
-		}	
-	
-		$seconds -= $years * 31536000;
-		$months = floor($seconds / 2628000);
-	
-		if ($years > 0 OR $months > 0)
-		{
-			if ($months > 0)
-			{	
-				$str .= $months.' '.$CI->lang->line((($months	> 1) ? 'date_months' : 'date_month')).', ';
-			}	
-	
-			$seconds -= $months * 2628000;
-		}
-
-		$weeks = floor($seconds / 604800);
-	
-		if ($years > 0 OR $months > 0 OR $weeks > 0)
-		{
-			if ($weeks > 0)
-			{	
-				$str .= $weeks.' '.$CI->lang->line((($weeks	> 1) ? 'date_weeks' : 'date_week')).', ';
-			}
-		
-			$seconds -= $weeks * 604800;
-		}			
-
-		$days = floor($seconds / 86400);
-	
-		if ($months > 0 OR $weeks > 0 OR $days > 0)
-		{
-			if ($days > 0)
-			{	
-				$str .= $days.' '.$CI->lang->line((($days	> 1) ? 'date_days' : 'date_day')).', ';
-			}
-	
-			$seconds -= $days * 86400;
-		}
-	
-		$hours = floor($seconds / 3600);
-	
-		if ($days > 0 OR $hours > 0)
-		{
-			if ($hours > 0)
-			{
-				$str .= $hours.' '.$CI->lang->line((($hours	> 1) ? 'date_hours' : 'date_hour')).', ';
-			}
-		
-			$seconds -= $hours * 3600;
-		}
-	
-		$minutes = floor($seconds / 60);
-	
-		if ($days > 0 OR $hours > 0 OR $minutes > 0)
-		{
-			if ($minutes > 0)
-			{	
-				$str .= $minutes.' '.$CI->lang->line((($minutes	> 1) ? 'date_minutes' : 'date_minute')).', ';
-			}
-		
-			$seconds -= $minutes * 60;
-		}
-	
-		if ($str == '')
-		{
-			$str .= $seconds.' '.$CI->lang->line((($seconds	> 1) ? 'date_seconds' : 'date_second')).', ';
-		}
-			
-		return substr(trim($str), 0, -1);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Number of days in a month
- *
- * Takes a month/year as input and returns the number of days
- * for the given month/year. Takes leap years into consideration.
- *
- * @access	public
- * @param	integer a numeric month
- * @param	integer	a numeric year
- * @return	integer
- */	
-if ( ! function_exists('days_in_month'))
-{
-	function days_in_month($month = 0, $year = '')
-	{
-		if ($month < 1 OR $month > 12)
-		{
-			return 0;
-		}
-	
-		if ( ! is_numeric($year) OR strlen($year) != 4)
-		{
-			$year = date('Y');
-		}
-	
-		if ($month == 2)
-		{
-			if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0))
-			{
-				return 29;
-			}
-		}
-
-		$days_in_month	= array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
-		return $days_in_month[$month - 1];
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Converts a local Unix timestamp to GMT
- *
- * @access	public
- * @param	integer Unix timestamp
- * @return	integer
- */	
-if ( ! function_exists('local_to_gmt'))
-{
-	function local_to_gmt($time = '')
-	{
-		if ($time == '')
-			$time = time();
-	
-		return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time));
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Converts GMT time to a localized value
- *
- * Takes a Unix timestamp (in GMT) as input, and returns
- * at the local value based on the timezone and DST setting
- * submitted
- *
- * @access	public
- * @param	integer Unix timestamp
- * @param	string	timezone
- * @param	bool	whether DST is active
- * @return	integer
- */	
-if ( ! function_exists('gmt_to_local'))
-{
-	function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
-	{			
-		if ($time == '')
-		{
-			return now();
-		}
-	
-		$time += timezones($timezone) * 3600;
-
-		if ($dst == TRUE)
-		{
-			$time += 3600;
-		}
-	
-		return $time;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Converts a MySQL Timestamp to Unix
- *
- * @access	public
- * @param	integer Unix timestamp
- * @return	integer
- */	
-if ( ! function_exists('mysql_to_unix'))
-{
-	function mysql_to_unix($time = '')
-	{
-		// We'll remove certain characters for backward compatibility
-		// since the formatting changed with MySQL 4.1
-		// YYYY-MM-DD HH:MM:SS
-	
-		$time = str_replace('-', '', $time);
-		$time = str_replace(':', '', $time);
-		$time = str_replace(' ', '', $time);
-	
-		// YYYYMMDDHHMMSS
-		return  mktime(
-						substr($time, 8, 2),
-						substr($time, 10, 2),
-						substr($time, 12, 2),
-						substr($time, 4, 2),
-						substr($time, 6, 2),
-						substr($time, 0, 4)
-						);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Unix to "Human"
- *
- * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
- *
- * @access	public
- * @param	integer Unix timestamp
- * @param	bool	whether to show seconds
- * @param	string	format: us or euro
- * @return	string
- */	
-if ( ! function_exists('unix_to_human'))
-{
-	function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
-	{
-		$r  = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
-		
-		if ($fmt == 'us')
-		{
-			$r .= date('h', $time).':'.date('i', $time);
-		}
-		else
-		{
-			$r .= date('H', $time).':'.date('i', $time);
-		}
-	
-		if ($seconds)
-		{
-			$r .= ':'.date('s', $time);
-		}
-	
-		if ($fmt == 'us')
-		{
-			$r .= ' '.date('A', $time);
-		}
-		
-		return $r;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Convert "human" date to GMT
- *
- * Reverses the above process
- *
- * @access	public
- * @param	string	format: us or euro
- * @return	integer
- */	
-if ( ! function_exists('human_to_unix'))
-{
-	function human_to_unix($datestr = '')
-	{
-		if ($datestr == '')
-		{
-			return FALSE;
-		}
-	
-		$datestr = trim($datestr);
-		$datestr = preg_replace("/\040+/", "\040", $datestr);
-
-		if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
-		{
-			return FALSE;
-		}
-
-		$split = preg_split("/\040/", $datestr);
-
-		$ex = explode("-", $split['0']);
-	
-		$year  = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
-		$month = (strlen($ex['1']) == 1) ? '0'.$ex['1']  : $ex['1'];
-		$day   = (strlen($ex['2']) == 1) ? '0'.$ex['2']  : $ex['2'];
-
-		$ex = explode(":", $split['1']);
-	
-		$hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
-		$min  = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
-
-		if (isset($ex['2']) AND ereg("[0-9]{1,2}", $ex['2']))
-		{
-			$sec  = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
-		}
-		else
-		{
-			// Unless specified, seconds get set to zero.
-			$sec = '00';
-		}
-	
-		if (isset($split['2']))
-		{
-			$ampm = strtolower($split['2']);
-		
-			if (substr($ampm, 0, 1) == 'p' AND $hour < 12)
-				$hour = $hour + 12;
-			
-			if (substr($ampm, 0, 1) == 'a' AND $hour == 12)
-				$hour =  '00';
-			
-			if (strlen($hour) == 1)
-				$hour = '0'.$hour;
-		}
-			
-		return mktime($hour, $min, $sec, $month, $day, $year);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Timezone Menu
- *
- * Generates a drop-down menu of timezones.
- *
- * @access	public
- * @param	string	timezone
- * @param	string	classname
- * @param	string	menu name
- * @return	string
- */	
-if ( ! function_exists('timezone_menu'))
-{
-	function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
-	{
-		$CI =& get_instance();
-		$CI->lang->load('date');
-	
-		if ($default == 'GMT')
-			$default = 'UTC';
-
-		$menu = '<select name="'.$name.'"';
-	
-		if ($class != '')
-		{
-			$menu .= ' class="'.$class.'"';
-		}
-	
-		$menu .= ">\n";
-	
-		foreach (timezones() as $key => $val)
-		{
-			$selected = ($default == $key) ? " selected='selected'" : '';
-			$menu .= "<option value='{$key}'{$selected}>".$CI->lang->line($key)."</option>\n";
-		}
-
-		$menu .= "</select>";
-
-		return $menu;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Timezones
- *
- * Returns an array of timezones.  This is a helper function
- * for various other ones in this library
- *
- * @access	public
- * @param	string	timezone
- * @return	string
- */	
-if ( ! function_exists('timezones'))
-{
-	function timezones($tz = '')
-	{
-		// Note: Don't change the order of these even though
-		// some items appear to be in the wrong order
-		
-		$zones = array( 
-						'UM12'		=> -12,
-						'UM11'		=> -11,
-						'UM10'		=> -10,
-						'UM95'		=> -9.5,
-						'UM9'		=> -9,
-						'UM8'		=> -8,
-						'UM7'		=> -7,
-						'UM6'		=> -6,
-						'UM5'		=> -5,
-						'UM45'		=> -4.5,
-						'UM4'		=> -4,
-						'UM35'		=> -3.5,
-						'UM3'		=> -3,
-						'UM2'		=> -2,
-						'UM1'		=> -1,
-						'UTC'		=> 0,
-						'UP1'		=> +1,
-						'UP2'		=> +2,
-						'UP3'		=> +3,
-						'UP35'		=> +3.5,
-						'UP4'		=> +4,
-						'UP45'		=> +4.5,
-						'UP5'		=> +5,
-						'UP55'		=> +5.5,
-						'UP575'		=> +5.75,
-						'UP6'		=> +6,
-						'UP65'		=> +6.5,
-						'UP7'		=> +7,
-						'UP8'		=> +8,
-						'UP875'		=> +8.75,
-						'UP9'		=> +9,
-						'UP95'		=> +9.5,
-						'UP10'		=> +10,
-						'UP105'		=> +10.5,
-						'UP11'		=> +11,
-						'UP115'		=> +11.5,
-						'UP12'		=> +12,
-						'UP1275'	=> +12.75,
-						'UP13'		=> +13,
-						'UP14'		=> +14
-					);
-				
-		if ($tz == '')
-		{
-			return $zones;
-		}
-	
-		if ($tz == 'GMT')
-			$tz = 'UTC';
-	
-		return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
-	}
-}
-
-
-/* End of file date_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Date Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/date_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get "now" time
+ *
+ * Returns time() or its GMT equivalent based on the config file preference
+ *
+ * @access	public
+ * @return	integer
+ */	
+if ( ! function_exists('now'))
+{
+	function now()
+	{
+		$CI =& get_instance();
+	
+		if (strtolower($CI->config->item('time_reference')) == 'gmt')
+		{
+			$now = time();
+			$system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
+	
+			if (strlen($system_time) < 10)
+			{
+				$system_time = time();
+				log_message('error', 'The Date class could not set a proper GMT timestamp so the local time() value was used.');
+			}
+	
+			return $system_time;
+		}
+		else
+		{
+			return time();
+		}
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Convert MySQL Style Datecodes
+ *
+ * This function is identical to PHPs date() function,
+ * except that it allows date codes to be formatted using
+ * the MySQL style, where each code letter is preceded
+ * with a percent sign:  %Y %m %d etc...
+ *
+ * The benefit of doing dates this way is that you don't
+ * have to worry about escaping your text letters that
+ * match the date codes.
+ *
+ * @access	public
+ * @param	string
+ * @param	integer
+ * @return	integer
+ */	
+if ( ! function_exists('mdate'))
+{
+	function mdate($datestr = '', $time = '')
+	{
+		if ($datestr == '')
+			return '';
+	
+		if ($time == '')
+			$time = now();
+		
+		$datestr = str_replace('%\\', '', preg_replace("/([a-z]+?){1}/i", "\\\\\\1", $datestr));
+		return date($datestr, $time);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Standard Date
+ *
+ * Returns a date formatted according to the submitted standard.
+ *
+ * @access	public
+ * @param	string	the chosen format
+ * @param	integer	Unix timestamp
+ * @return	string
+ */	
+if ( ! function_exists('standard_date'))
+{
+	function standard_date($fmt = 'DATE_RFC822', $time = '')
+	{
+		$formats = array(
+						'DATE_ATOM'		=>	'%Y-%m-%dT%H:%i:%s%Q',
+						'DATE_COOKIE'	=>	'%l, %d-%M-%y %H:%i:%s UTC',
+						'DATE_ISO8601'	=>	'%Y-%m-%dT%H:%i:%s%O',
+						'DATE_RFC822'	=>	'%D, %d %M %y %H:%i:%s %O',
+						'DATE_RFC850'	=>	'%l, %d-%M-%y %H:%m:%i UTC',
+						'DATE_RFC1036'	=>	'%D, %d %M %y %H:%i:%s %O',
+						'DATE_RFC1123'	=>	'%D, %d %M %Y %H:%i:%s %O',
+						'DATE_RSS'		=>	'%D, %d %M %Y %H:%i:%s %O',
+						'DATE_W3C'		=>	'%Y-%m-%dT%H:%i:%s%Q'
+						);
+
+		if ( ! isset($formats[$fmt]))
+		{
+			return FALSE;
+		}
+	
+		return mdate($formats[$fmt], $time);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Timespan
+ *
+ * Returns a span of seconds in this format:
+ *	10 days 14 hours 36 minutes 47 seconds
+ *
+ * @access	public
+ * @param	integer	a number of seconds
+ * @param	integer	Unix timestamp
+ * @return	integer
+ */	
+if ( ! function_exists('timespan'))
+{
+	function timespan($seconds = 1, $time = '')
+	{
+		$CI =& get_instance();
+		$CI->lang->load('date');
+
+		if ( ! is_numeric($seconds))
+		{
+			$seconds = 1;
+		}
+	
+		if ( ! is_numeric($time))
+		{
+			$time = time();
+		}
+	
+		if ($time <= $seconds)
+		{
+			$seconds = 1;
+		}
+		else
+		{
+			$seconds = $time - $seconds;
+		}
+		
+		$str = '';
+		$years = floor($seconds / 31536000);
+	
+		if ($years > 0)
+		{	
+			$str .= $years.' '.$CI->lang->line((($years	> 1) ? 'date_years' : 'date_year')).', ';
+		}	
+	
+		$seconds -= $years * 31536000;
+		$months = floor($seconds / 2628000);
+	
+		if ($years > 0 OR $months > 0)
+		{
+			if ($months > 0)
+			{	
+				$str .= $months.' '.$CI->lang->line((($months	> 1) ? 'date_months' : 'date_month')).', ';
+			}	
+	
+			$seconds -= $months * 2628000;
+		}
+
+		$weeks = floor($seconds / 604800);
+	
+		if ($years > 0 OR $months > 0 OR $weeks > 0)
+		{
+			if ($weeks > 0)
+			{	
+				$str .= $weeks.' '.$CI->lang->line((($weeks	> 1) ? 'date_weeks' : 'date_week')).', ';
+			}
+		
+			$seconds -= $weeks * 604800;
+		}			
+
+		$days = floor($seconds / 86400);
+	
+		if ($months > 0 OR $weeks > 0 OR $days > 0)
+		{
+			if ($days > 0)
+			{	
+				$str .= $days.' '.$CI->lang->line((($days	> 1) ? 'date_days' : 'date_day')).', ';
+			}
+	
+			$seconds -= $days * 86400;
+		}
+	
+		$hours = floor($seconds / 3600);
+	
+		if ($days > 0 OR $hours > 0)
+		{
+			if ($hours > 0)
+			{
+				$str .= $hours.' '.$CI->lang->line((($hours	> 1) ? 'date_hours' : 'date_hour')).', ';
+			}
+		
+			$seconds -= $hours * 3600;
+		}
+	
+		$minutes = floor($seconds / 60);
+	
+		if ($days > 0 OR $hours > 0 OR $minutes > 0)
+		{
+			if ($minutes > 0)
+			{	
+				$str .= $minutes.' '.$CI->lang->line((($minutes	> 1) ? 'date_minutes' : 'date_minute')).', ';
+			}
+		
+			$seconds -= $minutes * 60;
+		}
+	
+		if ($str == '')
+		{
+			$str .= $seconds.' '.$CI->lang->line((($seconds	> 1) ? 'date_seconds' : 'date_second')).', ';
+		}
+			
+		return substr(trim($str), 0, -1);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Number of days in a month
+ *
+ * Takes a month/year as input and returns the number of days
+ * for the given month/year. Takes leap years into consideration.
+ *
+ * @access	public
+ * @param	integer a numeric month
+ * @param	integer	a numeric year
+ * @return	integer
+ */	
+if ( ! function_exists('days_in_month'))
+{
+	function days_in_month($month = 0, $year = '')
+	{
+		if ($month < 1 OR $month > 12)
+		{
+			return 0;
+		}
+	
+		if ( ! is_numeric($year) OR strlen($year) != 4)
+		{
+			$year = date('Y');
+		}
+	
+		if ($month == 2)
+		{
+			if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0))
+			{
+				return 29;
+			}
+		}
+
+		$days_in_month	= array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+		return $days_in_month[$month - 1];
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Converts a local Unix timestamp to GMT
+ *
+ * @access	public
+ * @param	integer Unix timestamp
+ * @return	integer
+ */	
+if ( ! function_exists('local_to_gmt'))
+{
+	function local_to_gmt($time = '')
+	{
+		if ($time == '')
+			$time = time();
+	
+		return mktime( gmdate("H", $time), gmdate("i", $time), gmdate("s", $time), gmdate("m", $time), gmdate("d", $time), gmdate("Y", $time));
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Converts GMT time to a localized value
+ *
+ * Takes a Unix timestamp (in GMT) as input, and returns
+ * at the local value based on the timezone and DST setting
+ * submitted
+ *
+ * @access	public
+ * @param	integer Unix timestamp
+ * @param	string	timezone
+ * @param	bool	whether DST is active
+ * @return	integer
+ */	
+if ( ! function_exists('gmt_to_local'))
+{
+	function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
+	{			
+		if ($time == '')
+		{
+			return now();
+		}
+	
+		$time += timezones($timezone) * 3600;
+
+		if ($dst == TRUE)
+		{
+			$time += 3600;
+		}
+	
+		return $time;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Converts a MySQL Timestamp to Unix
+ *
+ * @access	public
+ * @param	integer Unix timestamp
+ * @return	integer
+ */	
+if ( ! function_exists('mysql_to_unix'))
+{
+	function mysql_to_unix($time = '')
+	{
+		// We'll remove certain characters for backward compatibility
+		// since the formatting changed with MySQL 4.1
+		// YYYY-MM-DD HH:MM:SS
+	
+		$time = str_replace('-', '', $time);
+		$time = str_replace(':', '', $time);
+		$time = str_replace(' ', '', $time);
+	
+		// YYYYMMDDHHMMSS
+		return  mktime(
+						substr($time, 8, 2),
+						substr($time, 10, 2),
+						substr($time, 12, 2),
+						substr($time, 4, 2),
+						substr($time, 6, 2),
+						substr($time, 0, 4)
+						);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Unix to "Human"
+ *
+ * Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
+ *
+ * @access	public
+ * @param	integer Unix timestamp
+ * @param	bool	whether to show seconds
+ * @param	string	format: us or euro
+ * @return	string
+ */	
+if ( ! function_exists('unix_to_human'))
+{
+	function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
+	{
+		$r  = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
+		
+		if ($fmt == 'us')
+		{
+			$r .= date('h', $time).':'.date('i', $time);
+		}
+		else
+		{
+			$r .= date('H', $time).':'.date('i', $time);
+		}
+	
+		if ($seconds)
+		{
+			$r .= ':'.date('s', $time);
+		}
+	
+		if ($fmt == 'us')
+		{
+			$r .= ' '.date('A', $time);
+		}
+		
+		return $r;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Convert "human" date to GMT
+ *
+ * Reverses the above process
+ *
+ * @access	public
+ * @param	string	format: us or euro
+ * @return	integer
+ */	
+if ( ! function_exists('human_to_unix'))
+{
+	function human_to_unix($datestr = '')
+	{
+		if ($datestr == '')
+		{
+			return FALSE;
+		}
+	
+		$datestr = trim($datestr);
+		$datestr = preg_replace("/\040+/", "\040", $datestr);
+
+		if ( ! preg_match('/^[0-9]{2,4}\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
+		{
+			return FALSE;
+		}
+
+		$split = preg_split("/\040/", $datestr);
+
+		$ex = explode("-", $split['0']);
+	
+		$year  = (strlen($ex['0']) == 2) ? '20'.$ex['0'] : $ex['0'];
+		$month = (strlen($ex['1']) == 1) ? '0'.$ex['1']  : $ex['1'];
+		$day   = (strlen($ex['2']) == 1) ? '0'.$ex['2']  : $ex['2'];
+
+		$ex = explode(":", $split['1']);
+	
+		$hour = (strlen($ex['0']) == 1) ? '0'.$ex['0'] : $ex['0'];
+		$min  = (strlen($ex['1']) == 1) ? '0'.$ex['1'] : $ex['1'];
+
+		if (isset($ex['2']) AND ereg("[0-9]{1,2}", $ex['2']))
+		{
+			$sec  = (strlen($ex['2']) == 1) ? '0'.$ex['2'] : $ex['2'];
+		}
+		else
+		{
+			// Unless specified, seconds get set to zero.
+			$sec = '00';
+		}
+	
+		if (isset($split['2']))
+		{
+			$ampm = strtolower($split['2']);
+		
+			if (substr($ampm, 0, 1) == 'p' AND $hour < 12)
+				$hour = $hour + 12;
+			
+			if (substr($ampm, 0, 1) == 'a' AND $hour == 12)
+				$hour =  '00';
+			
+			if (strlen($hour) == 1)
+				$hour = '0'.$hour;
+		}
+			
+		return mktime($hour, $min, $sec, $month, $day, $year);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Timezone Menu
+ *
+ * Generates a drop-down menu of timezones.
+ *
+ * @access	public
+ * @param	string	timezone
+ * @param	string	classname
+ * @param	string	menu name
+ * @return	string
+ */	
+if ( ! function_exists('timezone_menu'))
+{
+	function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
+	{
+		$CI =& get_instance();
+		$CI->lang->load('date');
+	
+		if ($default == 'GMT')
+			$default = 'UTC';
+
+		$menu = '<select name="'.$name.'"';
+	
+		if ($class != '')
+		{
+			$menu .= ' class="'.$class.'"';
+		}
+	
+		$menu .= ">\n";
+	
+		foreach (timezones() as $key => $val)
+		{
+			$selected = ($default == $key) ? " selected='selected'" : '';
+			$menu .= "<option value='{$key}'{$selected}>".$CI->lang->line($key)."</option>\n";
+		}
+
+		$menu .= "</select>";
+
+		return $menu;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Timezones
+ *
+ * Returns an array of timezones.  This is a helper function
+ * for various other ones in this library
+ *
+ * @access	public
+ * @param	string	timezone
+ * @return	string
+ */	
+if ( ! function_exists('timezones'))
+{
+	function timezones($tz = '')
+	{
+		// Note: Don't change the order of these even though
+		// some items appear to be in the wrong order
+		
+		$zones = array( 
+						'UM12'		=> -12,
+						'UM11'		=> -11,
+						'UM10'		=> -10,
+						'UM95'		=> -9.5,
+						'UM9'		=> -9,
+						'UM8'		=> -8,
+						'UM7'		=> -7,
+						'UM6'		=> -6,
+						'UM5'		=> -5,
+						'UM45'		=> -4.5,
+						'UM4'		=> -4,
+						'UM35'		=> -3.5,
+						'UM3'		=> -3,
+						'UM2'		=> -2,
+						'UM1'		=> -1,
+						'UTC'		=> 0,
+						'UP1'		=> +1,
+						'UP2'		=> +2,
+						'UP3'		=> +3,
+						'UP35'		=> +3.5,
+						'UP4'		=> +4,
+						'UP45'		=> +4.5,
+						'UP5'		=> +5,
+						'UP55'		=> +5.5,
+						'UP575'		=> +5.75,
+						'UP6'		=> +6,
+						'UP65'		=> +6.5,
+						'UP7'		=> +7,
+						'UP8'		=> +8,
+						'UP875'		=> +8.75,
+						'UP9'		=> +9,
+						'UP95'		=> +9.5,
+						'UP10'		=> +10,
+						'UP105'		=> +10.5,
+						'UP11'		=> +11,
+						'UP115'		=> +11.5,
+						'UP12'		=> +12,
+						'UP1275'	=> +12.75,
+						'UP13'		=> +13,
+						'UP14'		=> +14
+					);
+				
+		if ($tz == '')
+		{
+			return $zones;
+		}
+	
+		if ($tz == 'GMT')
+			$tz = 'UTC';
+	
+		return ( ! isset($zones[$tz])) ? 0 : $zones[$tz];
+	}
+}
+
+
+/* End of file date_helper.php */
 /* Location: ./system/helpers/date_helper.php */
\ No newline at end of file
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 8a1b999..be36590 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -1,80 +1,80 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Directory Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/directory_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Create a Directory Map
- *
- * Reads the specified directory and builds an array
- * representation of it.  Sub-folders contained with the
- * directory will be mapped as well.
- *
- * @access	public
- * @param	string	path to source
- * @param	bool	whether to limit the result to the top level only
- * @return	array
- */	
-if ( ! function_exists('directory_map'))
-{
-	function directory_map($source_dir, $top_level_only = FALSE)
-	{	
-		if ($fp = @opendir($source_dir))
-		{
-			$source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;		
-			$filedata = array();
-			
-			while (FALSE !== ($file = readdir($fp)))
-			{
-				if (strncmp($file, '.', 1) == 0)
-				{
-					continue;
-				}
-				
-				if ($top_level_only == FALSE && @is_dir($source_dir.$file))
-				{
-					$temp_array = array();
-				
-					$temp_array = directory_map($source_dir.$file.DIRECTORY_SEPARATOR);
-				
-					$filedata[$file] = $temp_array;
-				}
-				else
-				{
-					$filedata[] = $file;
-				}
-			}
-			
-			closedir($fp);
-			return $filedata;
-		}
-	}
-}
-
-
-/* End of file directory_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Directory Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/directory_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Create a Directory Map
+ *
+ * Reads the specified directory and builds an array
+ * representation of it.  Sub-folders contained with the
+ * directory will be mapped as well.
+ *
+ * @access	public
+ * @param	string	path to source
+ * @param	bool	whether to limit the result to the top level only
+ * @return	array
+ */	
+if ( ! function_exists('directory_map'))
+{
+	function directory_map($source_dir, $top_level_only = FALSE)
+	{	
+		if ($fp = @opendir($source_dir))
+		{
+			$source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;		
+			$filedata = array();
+			
+			while (FALSE !== ($file = readdir($fp)))
+			{
+				if (strncmp($file, '.', 1) == 0)
+				{
+					continue;
+				}
+				
+				if ($top_level_only == FALSE && @is_dir($source_dir.$file))
+				{
+					$temp_array = array();
+				
+					$temp_array = directory_map($source_dir.$file.DIRECTORY_SEPARATOR);
+				
+					$filedata[$file] = $temp_array;
+				}
+				else
+				{
+					$filedata[] = $file;
+				}
+			}
+			
+			closedir($fp);
+			return $filedata;
+		}
+	}
+}
+
+
+/* End of file directory_helper.php */
 /* Location: ./system/helpers/directory_helper.php */
\ No newline at end of file
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 2a555ae..ce2dd48 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -1,100 +1,100 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Download Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/download_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Force Download
- *
- * Generates headers that force a download to happen
- *
- * @access	public
- * @param	string	filename
- * @param	mixed	the data to be downloaded
- * @return	void
- */	
-if ( ! function_exists('force_download'))
-{
-	function force_download($filename = '', $data = '')
-	{
-		if ($filename == '' OR $data == '')
-		{
-			return FALSE;
-		}
-
-		// Try to determine if the filename includes a file extension.
-		// We need it in order to set the MIME type
-		if (FALSE === strpos($filename, '.'))
-		{
-			return FALSE;
-		}
-	
-		// Grab the file extension
-		$x = explode('.', $filename);
-		$extension = end($x);
-
-		// Load the mime types
-		@include(APPPATH.'config/mimes'.EXT);
-	
-		// Set a default mime if we can't find it
-		if ( ! isset($mimes[$extension]))
-		{
-			$mime = 'application/octet-stream';
-		}
-		else
-		{
-			$mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
-		}
-	
-		// Generate the server headers
-		if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
-		{
-			header('Content-Type: "'.$mime.'"');
-			header('Content-Disposition: attachment; filename="'.$filename.'"');
-			header('Expires: 0');
-			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-			header("Content-Transfer-Encoding: binary");
-			header('Pragma: public');
-			header("Content-Length: ".strlen($data));
-		}
-		else
-		{
-			header('Content-Type: "'.$mime.'"');
-			header('Content-Disposition: attachment; filename="'.$filename.'"');
-			header("Content-Transfer-Encoding: binary");
-			header('Expires: 0');
-			header('Pragma: no-cache');
-			header("Content-Length: ".strlen($data));
-		}
-	
-		exit($data);
-	}
-}
-
-
-/* End of file download_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Download Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/download_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Force Download
+ *
+ * Generates headers that force a download to happen
+ *
+ * @access	public
+ * @param	string	filename
+ * @param	mixed	the data to be downloaded
+ * @return	void
+ */	
+if ( ! function_exists('force_download'))
+{
+	function force_download($filename = '', $data = '')
+	{
+		if ($filename == '' OR $data == '')
+		{
+			return FALSE;
+		}
+
+		// Try to determine if the filename includes a file extension.
+		// We need it in order to set the MIME type
+		if (FALSE === strpos($filename, '.'))
+		{
+			return FALSE;
+		}
+	
+		// Grab the file extension
+		$x = explode('.', $filename);
+		$extension = end($x);
+
+		// Load the mime types
+		@include(APPPATH.'config/mimes'.EXT);
+	
+		// Set a default mime if we can't find it
+		if ( ! isset($mimes[$extension]))
+		{
+			$mime = 'application/octet-stream';
+		}
+		else
+		{
+			$mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] : $mimes[$extension];
+		}
+	
+		// Generate the server headers
+		if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
+		{
+			header('Content-Type: "'.$mime.'"');
+			header('Content-Disposition: attachment; filename="'.$filename.'"');
+			header('Expires: 0');
+			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+			header("Content-Transfer-Encoding: binary");
+			header('Pragma: public');
+			header("Content-Length: ".strlen($data));
+		}
+		else
+		{
+			header('Content-Type: "'.$mime.'"');
+			header('Content-Disposition: attachment; filename="'.$filename.'"');
+			header("Content-Transfer-Encoding: binary");
+			header('Expires: 0');
+			header('Pragma: no-cache');
+			header("Content-Length: ".strlen($data));
+		}
+	
+		exit($data);
+	}
+}
+
+
+/* End of file download_helper.php */
 /* Location: ./system/helpers/download_helper.php */
\ No newline at end of file
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index ab12b70..af1fdb9 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -1,62 +1,62 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Email Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/email_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Validate email address
- *
- * @access	public
- * @return	bool
- */	
-if ( ! function_exists('valid_email'))
-{
-	function valid_email($address)
-	{
-		return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Send an email
- *
- * @access	public
- * @return	bool
- */	
-if ( ! function_exists('send_email'))
-{
-	function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
-	{
-		return mail($recipient, $subject, $message);
-	}
-}
-
-
-/* End of file email_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Email Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/email_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validate email address
+ *
+ * @access	public
+ * @return	bool
+ */	
+if ( ! function_exists('valid_email'))
+{
+	function valid_email($address)
+	{
+		return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Send an email
+ *
+ * @access	public
+ * @return	bool
+ */	
+if ( ! function_exists('send_email'))
+{
+	function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
+	{
+		return mail($recipient, $subject, $message);
+	}
+}
+
+
+/* End of file email_helper.php */
 /* Location: ./system/helpers/email_helper.php */
\ No newline at end of file
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 6378784..8078d96 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -1,465 +1,465 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter File Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/file_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Read File
- *
- * Opens the file specfied in the path and returns it as a string.
- *
- * @access	public
- * @param	string	path to file
- * @return	string
- */	
-if ( ! function_exists('read_file'))
-{
-	function read_file($file)
-	{
-		if ( ! file_exists($file))
-		{
-			return FALSE;
-		}
-	
-		if (function_exists('file_get_contents'))
-		{
-			return file_get_contents($file);		
-		}
-
-		if ( ! $fp = @fopen($file, FOPEN_READ))
-		{
-			return FALSE;
-		}
-		
-		flock($fp, LOCK_SH);
-	
-		$data = '';
-		if (filesize($file) > 0)
-		{
-			$data =& fread($fp, filesize($file));
-		}
-
-		flock($fp, LOCK_UN);
-		fclose($fp);
-
-		return $data;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Write File
- *
- * Writes data to the file specified in the path.
- * Creates a new file if non-existent.
- *
- * @access	public
- * @param	string	path to file
- * @param	string	file data
- * @return	bool
- */	
-if ( ! function_exists('write_file'))
-{
-	function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
-	{
-		if ( ! $fp = @fopen($path, $mode))
-		{
-			return FALSE;
-		}
-		
-		flock($fp, LOCK_EX);
-		fwrite($fp, $data);
-		flock($fp, LOCK_UN);
-		fclose($fp);	
-
-		return TRUE;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Delete Files
- *
- * Deletes all files contained in the supplied directory path.
- * Files must be writable or owned by the system in order to be deleted.
- * If the second parameter is set to TRUE, any directories contained
- * within the supplied base directory will be nuked as well.
- *
- * @access	public
- * @param	string	path to file
- * @param	bool	whether to delete any directories found in the path
- * @return	bool
- */	
-if ( ! function_exists('delete_files'))
-{
-	function delete_files($path, $del_dir = FALSE, $level = 0)
-	{	
-		// Trim the trailing slash
-		$path = preg_replace("|^(.+?)/*$|", "\\1", $path);
-		
-		if ( ! $current_dir = @opendir($path))
-			return;
-	
-		while(FALSE !== ($filename = @readdir($current_dir)))
-		{
-			if ($filename != "." and $filename != "..")
-			{
-				if (is_dir($path.'/'.$filename))
-				{
-					// Ignore empty folders
-					if (substr($filename, 0, 1) != '.')
-					{
-						delete_files($path.'/'.$filename, $del_dir, $level + 1);
-					}
-				}
-				else
-				{
-					unlink($path.'/'.$filename);
-				}
-			}
-		}
-		@closedir($current_dir);
-	
-		if ($del_dir == TRUE AND $level > 0)
-		{
-			@rmdir($path);
-		}
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Get Filenames
- *
- * Reads the specified directory and builds an array containing the filenames.  
- * Any sub-folders contained within the specified path are read as well.
- *
- * @access	public
- * @param	string	path to source
- * @param	bool	whether to include the path as part of the filename
- * @param	bool	internal variable to determine recursion status - do not use in calls
- * @return	array
- */	
-if ( ! function_exists('get_filenames'))
-{
-	function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
-	{
-		static $_filedata = array();
-				
-		if ($fp = @opendir($source_dir))
-		{
-			// reset the array and make sure $source_dir has a trailing slash on the initial call
-			if ($_recursion === FALSE)
-			{
-				$_filedata = array();
-				$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
-			}
-			
-			while (FALSE !== ($file = readdir($fp)))
-			{
-				if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
-				{
-					 get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
-				}
-				elseif (strncmp($file, '.', 1) !== 0)
-				{
-			
-					$_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
-				}
-			}
-			return $_filedata;
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Get Directory File Information
- *
- * Reads the specified directory and builds an array containing the filenames,  
- * filesize, dates, and permissions
- *
- * Any sub-folders contained within the specified path are read as well.
- *
- * @access	public
- * @param	string	path to source
- * @param	bool	whether to include the path as part of the filename
- * @param	bool	internal variable to determine recursion status - do not use in calls
- * @return	array
- */	
-if ( ! function_exists('get_dir_file_info'))
-{
-	function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE)
-	{
-		$_filedata = array();
-		$relative_path = $source_dir;
-				
-		if ($fp = @opendir($source_dir))
-		{
-			// reset the array and make sure $source_dir has a trailing slash on the initial call
-			if ($_recursion === FALSE)
-			{
-				$_filedata = array();
-				$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
-			}
-
-			while (FALSE !== ($file = readdir($fp)))
-			{
-				if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
-				{
-					 get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
-				}
-				elseif (strncmp($file, '.', 1) !== 0)
-				{
-					$_filedata[$file] = get_file_info($source_dir.$file);
-					$_filedata[$file]['relative_path'] = $relative_path;
-				}
-			}
-			return $_filedata;
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
-* Get File Info
-*
-* Given a file and path, returns the name, path, size, date modified
-* Second parameter allows you to explicitly declare what information you want returned
-* Options are: name, server_path, size, date, readable, writable, executable, fileperms
-* Returns FALSE if the file cannot be found.
-*
-* @access	public
-* @param	string		path to file
-* @param	mixed		array or comma separated string of information returned
-* @return	array
-*/
-if ( ! function_exists('get_file_info'))
-{
-	function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
-	{
-
-		if ( ! file_exists($file))
-		{
-			return FALSE;
-		}
-
-		if (is_string($returned_values))
-		{
-			$returned_values = explode(',', $returned_values);
-		}
-
-		foreach ($returned_values as $key)
-		{
-			switch ($key)
-			{
-				case 'name':
-					$fileinfo['name'] = substr(strrchr($file, '/'), 1);
-					break;
-				case 'server_path':
-					$fileinfo['server_path'] = $file;
-					break;
-				case 'size':
-					$fileinfo['size'] = filesize($file);
-					break;
-				case 'date':
-					$fileinfo['date'] = filectime($file);
-					break;
-				case 'readable':
-					$fileinfo['readable'] = is_readable($file);
-					break;
-				case 'writable':
-					// There are known problems using is_weritable on IIS.  It may not be reliable - consider fileperms()
-					$fileinfo['writable'] = is_writable($file);
-					break;
-				case 'executable':
-					$fileinfo['executable'] = is_executable($file);
-					break;
-				case 'fileperms':
-					$fileinfo['fileperms'] = fileperms($file);
-					break;
-			}
-		}
-
-		return $fileinfo;
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Get Mime by Extension
- *
- * Translates a file extension into a mime type based on config/mimes.php. 
- * Returns FALSE if it can't determine the type, or open the mime config file
- *
- * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
- * It should NOT be trusted, and should certainly NOT be used for security
- *
- * @access	public
- * @param	string	path to file
- * @return	mixed
- */	
-if ( ! function_exists('get_mime_by_extension'))
-{
-	function get_mime_by_extension($file)
-	{
-		$extension = substr(strrchr($file, '.'), 1);
-	
-		global $mimes;
-	
-		if ( ! is_array($mimes))
-		{
-			if ( ! require_once(APPPATH.'config/mimes.php'))
-			{
-				return FALSE;
-			}
-		}
-
-		if (array_key_exists($extension, $mimes))
-		{
-			if (is_array($mimes[$extension]))
-			{
-				// Multiple mime types, just give the first one
-				return current($mimes[$extension]);
-			}
-			else
-			{
-				return $mimes[$extension];
-			}
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Symbolic Permissions
- *
- * Takes a numeric value representing a file's permissions and returns
- * standard symbolic notation representing that value
- *
- * @access	public
- * @param	int
- * @return	string
- */	
-if ( ! function_exists('symbolic_permissions'))
-{
-	function symbolic_permissions($perms)
-	{	
-		if (($perms & 0xC000) == 0xC000)
-		{
-			$symbolic = 's'; // Socket
-		}
-		elseif (($perms & 0xA000) == 0xA000)
-		{
-			$symbolic = 'l'; // Symbolic Link
-		}
-		elseif (($perms & 0x8000) == 0x8000)
-		{
-			$symbolic = '-'; // Regular
-		}
-		elseif (($perms & 0x6000) == 0x6000)
-		{
-			$symbolic = 'b'; // Block special
-		}
-		elseif (($perms & 0x4000) == 0x4000)
-		{
-			$symbolic = 'd'; // Directory
-		}
-		elseif (($perms & 0x2000) == 0x2000)
-		{
-			$symbolic = 'c'; // Character special
-		}
-		elseif (($perms & 0x1000) == 0x1000)
-		{
-			$symbolic = 'p'; // FIFO pipe
-		}
-		else
-		{
-			$symbolic = 'u'; // Unknown
-		}
-
-		// Owner
-		$symbolic .= (($perms & 0x0100) ? 'r' : '-');
-		$symbolic .= (($perms & 0x0080) ? 'w' : '-');
-		$symbolic .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
-
-		// Group
-		$symbolic .= (($perms & 0x0020) ? 'r' : '-');
-		$symbolic .= (($perms & 0x0010) ? 'w' : '-');
-		$symbolic .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
-
-		// World
-		$symbolic .= (($perms & 0x0004) ? 'r' : '-');
-		$symbolic .= (($perms & 0x0002) ? 'w' : '-');
-		$symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
-
-		return $symbolic;		
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Octal Permissions
- *
- * Takes a numeric value representing a file's permissions and returns
- * a three character string representing the file's octal permissions
- *
- * @access	public
- * @param	int
- * @return	string
- */	
-if ( ! function_exists('octal_permissions'))
-{
-	function octal_permissions($perms)
-	{
-		return substr(sprintf('%o', $perms), -3);
-	}
-}
-
-
-/* End of file file_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter File Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/file_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Read File
+ *
+ * Opens the file specfied in the path and returns it as a string.
+ *
+ * @access	public
+ * @param	string	path to file
+ * @return	string
+ */	
+if ( ! function_exists('read_file'))
+{
+	function read_file($file)
+	{
+		if ( ! file_exists($file))
+		{
+			return FALSE;
+		}
+	
+		if (function_exists('file_get_contents'))
+		{
+			return file_get_contents($file);		
+		}
+
+		if ( ! $fp = @fopen($file, FOPEN_READ))
+		{
+			return FALSE;
+		}
+		
+		flock($fp, LOCK_SH);
+	
+		$data = '';
+		if (filesize($file) > 0)
+		{
+			$data =& fread($fp, filesize($file));
+		}
+
+		flock($fp, LOCK_UN);
+		fclose($fp);
+
+		return $data;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Write File
+ *
+ * Writes data to the file specified in the path.
+ * Creates a new file if non-existent.
+ *
+ * @access	public
+ * @param	string	path to file
+ * @param	string	file data
+ * @return	bool
+ */	
+if ( ! function_exists('write_file'))
+{
+	function write_file($path, $data, $mode = FOPEN_WRITE_CREATE_DESTRUCTIVE)
+	{
+		if ( ! $fp = @fopen($path, $mode))
+		{
+			return FALSE;
+		}
+		
+		flock($fp, LOCK_EX);
+		fwrite($fp, $data);
+		flock($fp, LOCK_UN);
+		fclose($fp);	
+
+		return TRUE;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Delete Files
+ *
+ * Deletes all files contained in the supplied directory path.
+ * Files must be writable or owned by the system in order to be deleted.
+ * If the second parameter is set to TRUE, any directories contained
+ * within the supplied base directory will be nuked as well.
+ *
+ * @access	public
+ * @param	string	path to file
+ * @param	bool	whether to delete any directories found in the path
+ * @return	bool
+ */	
+if ( ! function_exists('delete_files'))
+{
+	function delete_files($path, $del_dir = FALSE, $level = 0)
+	{	
+		// Trim the trailing slash
+		$path = preg_replace("|^(.+?)/*$|", "\\1", $path);
+		
+		if ( ! $current_dir = @opendir($path))
+			return;
+	
+		while(FALSE !== ($filename = @readdir($current_dir)))
+		{
+			if ($filename != "." and $filename != "..")
+			{
+				if (is_dir($path.'/'.$filename))
+				{
+					// Ignore empty folders
+					if (substr($filename, 0, 1) != '.')
+					{
+						delete_files($path.'/'.$filename, $del_dir, $level + 1);
+					}
+				}
+				else
+				{
+					unlink($path.'/'.$filename);
+				}
+			}
+		}
+		@closedir($current_dir);
+	
+		if ($del_dir == TRUE AND $level > 0)
+		{
+			@rmdir($path);
+		}
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get Filenames
+ *
+ * Reads the specified directory and builds an array containing the filenames.  
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access	public
+ * @param	string	path to source
+ * @param	bool	whether to include the path as part of the filename
+ * @param	bool	internal variable to determine recursion status - do not use in calls
+ * @return	array
+ */	
+if ( ! function_exists('get_filenames'))
+{
+	function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
+	{
+		static $_filedata = array();
+				
+		if ($fp = @opendir($source_dir))
+		{
+			// reset the array and make sure $source_dir has a trailing slash on the initial call
+			if ($_recursion === FALSE)
+			{
+				$_filedata = array();
+				$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+			}
+			
+			while (FALSE !== ($file = readdir($fp)))
+			{
+				if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
+				{
+					 get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+				}
+				elseif (strncmp($file, '.', 1) !== 0)
+				{
+			
+					$_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
+				}
+			}
+			return $_filedata;
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Get Directory File Information
+ *
+ * Reads the specified directory and builds an array containing the filenames,  
+ * filesize, dates, and permissions
+ *
+ * Any sub-folders contained within the specified path are read as well.
+ *
+ * @access	public
+ * @param	string	path to source
+ * @param	bool	whether to include the path as part of the filename
+ * @param	bool	internal variable to determine recursion status - do not use in calls
+ * @return	array
+ */	
+if ( ! function_exists('get_dir_file_info'))
+{
+	function get_dir_file_info($source_dir, $include_path = FALSE, $_recursion = FALSE)
+	{
+		$_filedata = array();
+		$relative_path = $source_dir;
+				
+		if ($fp = @opendir($source_dir))
+		{
+			// reset the array and make sure $source_dir has a trailing slash on the initial call
+			if ($_recursion === FALSE)
+			{
+				$_filedata = array();
+				$source_dir = rtrim(realpath($source_dir), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+			}
+
+			while (FALSE !== ($file = readdir($fp)))
+			{
+				if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
+				{
+					 get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
+				}
+				elseif (strncmp($file, '.', 1) !== 0)
+				{
+					$_filedata[$file] = get_file_info($source_dir.$file);
+					$_filedata[$file]['relative_path'] = $relative_path;
+				}
+			}
+			return $_filedata;
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+* Get File Info
+*
+* Given a file and path, returns the name, path, size, date modified
+* Second parameter allows you to explicitly declare what information you want returned
+* Options are: name, server_path, size, date, readable, writable, executable, fileperms
+* Returns FALSE if the file cannot be found.
+*
+* @access	public
+* @param	string		path to file
+* @param	mixed		array or comma separated string of information returned
+* @return	array
+*/
+if ( ! function_exists('get_file_info'))
+{
+	function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
+	{
+
+		if ( ! file_exists($file))
+		{
+			return FALSE;
+		}
+
+		if (is_string($returned_values))
+		{
+			$returned_values = explode(',', $returned_values);
+		}
+
+		foreach ($returned_values as $key)
+		{
+			switch ($key)
+			{
+				case 'name':
+					$fileinfo['name'] = substr(strrchr($file, '/'), 1);
+					break;
+				case 'server_path':
+					$fileinfo['server_path'] = $file;
+					break;
+				case 'size':
+					$fileinfo['size'] = filesize($file);
+					break;
+				case 'date':
+					$fileinfo['date'] = filectime($file);
+					break;
+				case 'readable':
+					$fileinfo['readable'] = is_readable($file);
+					break;
+				case 'writable':
+					// There are known problems using is_weritable on IIS.  It may not be reliable - consider fileperms()
+					$fileinfo['writable'] = is_writable($file);
+					break;
+				case 'executable':
+					$fileinfo['executable'] = is_executable($file);
+					break;
+				case 'fileperms':
+					$fileinfo['fileperms'] = fileperms($file);
+					break;
+			}
+		}
+
+		return $fileinfo;
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Get Mime by Extension
+ *
+ * Translates a file extension into a mime type based on config/mimes.php. 
+ * Returns FALSE if it can't determine the type, or open the mime config file
+ *
+ * Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
+ * It should NOT be trusted, and should certainly NOT be used for security
+ *
+ * @access	public
+ * @param	string	path to file
+ * @return	mixed
+ */	
+if ( ! function_exists('get_mime_by_extension'))
+{
+	function get_mime_by_extension($file)
+	{
+		$extension = substr(strrchr($file, '.'), 1);
+	
+		global $mimes;
+	
+		if ( ! is_array($mimes))
+		{
+			if ( ! require_once(APPPATH.'config/mimes.php'))
+			{
+				return FALSE;
+			}
+		}
+
+		if (array_key_exists($extension, $mimes))
+		{
+			if (is_array($mimes[$extension]))
+			{
+				// Multiple mime types, just give the first one
+				return current($mimes[$extension]);
+			}
+			else
+			{
+				return $mimes[$extension];
+			}
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Symbolic Permissions
+ *
+ * Takes a numeric value representing a file's permissions and returns
+ * standard symbolic notation representing that value
+ *
+ * @access	public
+ * @param	int
+ * @return	string
+ */	
+if ( ! function_exists('symbolic_permissions'))
+{
+	function symbolic_permissions($perms)
+	{	
+		if (($perms & 0xC000) == 0xC000)
+		{
+			$symbolic = 's'; // Socket
+		}
+		elseif (($perms & 0xA000) == 0xA000)
+		{
+			$symbolic = 'l'; // Symbolic Link
+		}
+		elseif (($perms & 0x8000) == 0x8000)
+		{
+			$symbolic = '-'; // Regular
+		}
+		elseif (($perms & 0x6000) == 0x6000)
+		{
+			$symbolic = 'b'; // Block special
+		}
+		elseif (($perms & 0x4000) == 0x4000)
+		{
+			$symbolic = 'd'; // Directory
+		}
+		elseif (($perms & 0x2000) == 0x2000)
+		{
+			$symbolic = 'c'; // Character special
+		}
+		elseif (($perms & 0x1000) == 0x1000)
+		{
+			$symbolic = 'p'; // FIFO pipe
+		}
+		else
+		{
+			$symbolic = 'u'; // Unknown
+		}
+
+		// Owner
+		$symbolic .= (($perms & 0x0100) ? 'r' : '-');
+		$symbolic .= (($perms & 0x0080) ? 'w' : '-');
+		$symbolic .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
+
+		// Group
+		$symbolic .= (($perms & 0x0020) ? 'r' : '-');
+		$symbolic .= (($perms & 0x0010) ? 'w' : '-');
+		$symbolic .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
+
+		// World
+		$symbolic .= (($perms & 0x0004) ? 'r' : '-');
+		$symbolic .= (($perms & 0x0002) ? 'w' : '-');
+		$symbolic .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
+
+		return $symbolic;		
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Octal Permissions
+ *
+ * Takes a numeric value representing a file's permissions and returns
+ * a three character string representing the file's octal permissions
+ *
+ * @access	public
+ * @param	int
+ * @return	string
+ */	
+if ( ! function_exists('octal_permissions'))
+{
+	function octal_permissions($perms)
+	{
+		return substr(sprintf('%o', $perms), -3);
+	}
+}
+
+
+/* End of file file_helper.php */
 /* Location: ./system/helpers/file_helper.php */
\ No newline at end of file
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 109d8c1..c002c6f 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -1,963 +1,963 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Form Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/form_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Declaration
- *
- * Creates the opening portion of the form.
- *
- * @access	public
- * @param	string	the URI segments of the form destination
- * @param	array	a key/value pair of attributes
- * @param	array	a key/value pair hidden data
- * @return	string
- */	
-if ( ! function_exists('form_open'))
-{
-	function form_open($action = '', $attributes = '', $hidden = array())
-	{
-		$CI =& get_instance();
-
-		if ($attributes == '')
-		{
-			$attributes = 'method="post"';
-		}
-
-		$action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action;
-
-		$form = '<form action="'.$action.'"';
-	
-		$form .= _attributes_to_string($attributes, TRUE);
-	
-		$form .= '>';
-
-		if (is_array($hidden) AND count($hidden) > 0)
-		{
-			$form .= form_hidden($hidden);
-		}
-
-		return $form;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Declaration - Multipart type
- *
- * Creates the opening portion of the form, but with "multipart/form-data".
- *
- * @access	public
- * @param	string	the URI segments of the form destination
- * @param	array	a key/value pair of attributes
- * @param	array	a key/value pair hidden data
- * @return	string
- */
-if ( ! function_exists('form_open_multipart'))
-{
-	function form_open_multipart($action, $attributes = array(), $hidden = array())
-	{
-		$attributes['enctype'] = 'multipart/form-data';
-		return form_open($action, $attributes, $hidden);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Hidden Input Field
- *
- * Generates hidden fields.  You can pass a simple key/value string or an associative
- * array with multiple values.
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_hidden'))
-{
-	function form_hidden($name, $value = '')
-	{
-		if ( ! is_array($name))
-		{
-			return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
-		}
-
-		$form = '';
-
-		foreach ($name as $name => $value)
-		{
-			$form .= "\n";
-			$form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
-		}
-
-		return $form;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Text Input Field
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_input'))
-{
-	function form_input($data = '', $value = '', $extra = '')
-	{
-		$defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
-
-		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Password Field
- *
- * Identical to the input function but adds the "password" type
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_password'))
-{
-	function form_password($data = '', $value = '', $extra = '')
-	{
-		if ( ! is_array($data))
-		{
-			$data = array('name' => $data);
-		}
-
-		$data['type'] = 'password';
-		return form_input($data, $value, $extra);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Upload Field
- *
- * Identical to the input function but adds the "file" type
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_upload'))
-{
-	function form_upload($data = '', $value = '', $extra = '')
-	{
-		if ( ! is_array($data))
-		{
-			$data = array('name' => $data);
-		}
-
-		$data['type'] = 'file';
-		return form_input($data, $value, $extra);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Textarea field
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_textarea'))
-{
-	function form_textarea($data = '', $value = '', $extra = '')
-	{
-		$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
-
-		if ( ! is_array($data) OR ! isset($data['value']))
-		{
-			$val = $value;
-		}
-		else
-		{
-			$val = $data['value']; 
-			unset($data['value']); // textareas don't use the value attribute
-		}
-
-		return "<textarea "._parse_form_attributes($data, $defaults).$extra.">".$val."</textarea>";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Drop-down Menu
- *
- * @access	public
- * @param	string
- * @param	array
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_dropdown'))
-{
-	function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
-	{
-		if ( ! is_array($selected))
-		{
-			$selected = array($selected);
-		}
-
-		// If no selected state was submitted we will attempt to set it automatically
-		if (count($selected) === 0)
-		{
-			// If the form name appears in the $_POST array we have a winner!
-			if (isset($_POST[$name]))
-			{
-				$selected = array($_POST[$name]);
-			}
-		}
-
-		if ($extra != '') $extra = ' '.$extra;
-
-		$multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
-
-		$form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
-	
-		foreach ($options as $key => $val)
-		{
-			$key = (string) $key;
-			$val = (string) $val;
-
-			$sel = (in_array($key, $selected))?' selected="selected"':'';
-
-			$form .= '<option value="'.$key.'"'.$sel.'>'.$val."</option>\n";
-		}
-
-		$form .= '</select>';
-
-		return $form;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Checkbox Field
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	bool
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_checkbox'))
-{
-	function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
-	{
-		$defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
-
-		if (is_array($data) AND array_key_exists('checked', $data))
-		{
-			$checked = $data['checked'];
-
-			if ($checked == FALSE)
-			{
-				unset($data['checked']);
-			}
-			else
-			{
-				$data['checked'] = 'checked';
-			}
-		}
-
-		if ($checked == TRUE)
-		{
-			$defaults['checked'] = 'checked';
-		}
-		else
-		{
-			unset($defaults['checked']);
-		}
-
-		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Radio Button
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	bool
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_radio'))
-{
-	function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
-	{
-		if ( ! is_array($data))
-		{	
-			$data = array('name' => $data);
-		}
-
-		$data['type'] = 'radio';
-		return form_checkbox($data, $value, $checked, $extra);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Submit Button
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_submit'))
-{	
-	function form_submit($data = '', $value = '', $extra = '')
-	{
-		$defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
-
-		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Reset Button
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_reset'))
-{
-	function form_reset($data = '', $value = '', $extra = '')
-	{
-		$defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
-
-		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Button
- *
- * @access	public
- * @param	mixed
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_button'))
-{
-	function form_button($data = '', $content = '', $extra = '')
-	{
-		$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'submit');
-
-		if ( is_array($data) AND isset($data['content']))
-		{
-			$content = $data['content'];
-			unset($data['content']); // content is not an attribute
-		}
-
-		return "<button "._parse_form_attributes($data, $defaults).$extra.">".$content."</button>";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Label Tag
- *
- * @access	public
- * @param	string	The text to appear onscreen
- * @param	string	The id the label applies to
- * @param	string	Additional attributes
- * @return	string
- */
-if ( ! function_exists('form_label'))
-{
-	function form_label($label_text = '', $id = '', $attributes = array())
-	{
-
-		$label = '<label';
-
-		if ($id != '')
-		{
-			 $label .= " for=\"$id\"";
-		}
-
-		if (is_array($attributes) AND count($attributes) > 0)
-		{
-			foreach ($attributes as $key => $val)
-			{
-				$label .= ' '.$key.'="'.$val.'"';
-			}
-		}
-
-		$label .= ">$label_text</label>";
-
-		return $label;
-	}
-}
-
-// ------------------------------------------------------------------------
-/**
- * Fieldset Tag
- *
- * Used to produce <fieldset><legend>text</legend>.  To close fieldset
- * use form_fieldset_close()
- *
- * @access	public
- * @param	string	The legend text
- * @param	string	Additional attributes
- * @return	string
- */
-if ( ! function_exists('form_fieldset'))
-{
-	function form_fieldset($legend_text = '', $attributes = array())
-	{
-		$fieldset = "<fieldset";
-
-		$fieldset .= _attributes_to_string($attributes, FALSE);
-
-		$fieldset .= ">\n";
-
-		if ($legend_text != '')
-		{
-			$fieldset .= "<legend>$legend_text</legend>\n";
-		}
-
-		return $fieldset;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Fieldset Close Tag
- *
- * @access	public
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_fieldset_close'))
-{
-	function form_fieldset_close($extra = '')
-	{
-		return "</fieldset>".$extra;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Close Tag
- *
- * @access	public
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_close'))
-{
-	function form_close($extra = '')
-	{
-		return "</form>".$extra;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Prep
- *
- * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
- *
- * @access	public
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_prep'))
-{
-	function form_prep($str = '')
-	{
-		// if the field name is an array we do this recursively
-		if (is_array($str))
-		{
-			foreach ($str as $key => $val)
-			{
-				$str[$key] = form_prep($val);
-			}
-
-			return $str;
-		}
-
-		if ($str === '')
-		{
-			return '';
-		}
-
-		$temp = '__TEMP_AMPERSANDS__';
-
-		// Replace entities to temporary markers so that 
-		// htmlspecialchars won't mess them up
-		$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
-		$str = preg_replace("/&(\w+);/",  "$temp\\1;", $str);
-
-		$str = htmlspecialchars($str);
-
-		// In case htmlspecialchars misses these.
-		$str = str_replace(array("'", '"'), array("&#39;", "&quot;"), $str);
-
-		// Decode the temp markers back to entities
-		$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
-		$str = preg_replace("/$temp(\w+);/","&\\1;",$str);
-
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Value
- *
- * Grabs a value from the POST array for the specified field so you can
- * re-populate an input field or textarea.  If Form Validation
- * is active it retrieves the info from the validation class
- *
- * @access	public
- * @param	string
- * @return	mixed
- */
-if ( ! function_exists('set_value'))
-{
-	function set_value($field = '', $default = '')
-	{
-		if (FALSE === ($OBJ =& _get_validation_object()))
-		{
-			if ( ! isset($_POST[$field]))
-			{
-				return $default;
-			}
-
-			return form_prep($_POST[$field]);
-		}
-
-		return form_prep($OBJ->set_value($field, $default));
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Set Select
- *
- * Let's you set the selected value of a <select> menu via data in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @access	public
- * @param	string
- * @param	string
- * @param	bool
- * @return	string
- */
-if ( ! function_exists('set_select'))
-{
-	function set_select($field = '', $value = '', $default = FALSE)
-	{
-		$OBJ =& _get_validation_object();
-
-		if ($OBJ === FALSE)
-		{
-			if ( ! isset($_POST[$field]))
-			{
-				if (count($_POST) === 0)
-				{
-					return ' selected="selected"';
-				}
-				return '';
-			}
-
-			$field = $_POST[$field];
-
-			if (is_array($field))
-			{
-				if ( ! in_array($value, $field))
-				{
-					return '';
-				}
-			}
-			else
-			{
-				if (($field == '' OR $value == '') OR ($field != $value))
-				{
-					return '';
-				}
-			}
-
-			return ' selected="selected"';
-		}
-
-		return $OBJ->set_select($field, $value, $default);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Set Checkbox
- *
- * Let's you set the selected value of a checkbox via the value in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @access	public
- * @param	string
- * @param	string
- * @param	bool
- * @return	string
- */
-if ( ! function_exists('set_checkbox'))
-{
-	function set_checkbox($field = '', $value = '', $default = FALSE)
-	{
-		$OBJ =& _get_validation_object();
-
-		if ($OBJ === FALSE)
-		{ 
-			if ( ! isset($_POST[$field]))
-			{
-				if (count($_POST) === 0)
-				{
-					return ' checked="checked"';
-				}
-				return '';
-			}
-
-			$field = $_POST[$field];
-			
-			if (is_array($field))
-			{
-				if ( ! in_array($value, $field))
-				{
-					return '';
-				}
-			}
-			else
-			{
-				if (($field == '' OR $value == '') OR ($field != $value))
-				{
-					return '';
-				}
-			}
-
-			return ' checked="checked"';
-		}
-
-		return $OBJ->set_checkbox($field, $value, $default);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Set Radio
- *
- * Let's you set the selected value of a radio field via info in the POST array.
- * If Form Validation is active it retrieves the info from the validation class
- *
- * @access	public
- * @param	string
- * @param	string
- * @param	bool
- * @return	string
- */
-if ( ! function_exists('set_radio'))
-{
-	function set_radio($field = '', $value = '', $default = FALSE)
-	{
-		$OBJ =& _get_validation_object();
-
-		if ($OBJ === FALSE)
-		{
-			if ( ! isset($_POST[$field]))
-			{
-				if (count($_POST) === 0)
-				{
-					return ' checked="checked"';
-				}
-				return '';
-			}
-
-			$field = $_POST[$field];
-			
-			if (is_array($field))
-			{
-				if ( ! in_array($value, $field))
-				{
-					return '';
-				}
-			}
-			else
-			{
-				if (($field == '' OR $value == '') OR ($field != $value))
-				{
-					return '';
-				}
-			}
-
-			return ' checked="checked"';
-		}
-
-		return $OBJ->set_radio($field, $value, $default);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Form Error
- *
- * Returns the error for a specific form field.  This is a helper for the
- * form validation class.
- *
- * @access	public
- * @param	string
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('form_error'))
-{
-	function form_error($field = '', $prefix = '', $suffix = '')
-	{
-		if (FALSE === ($OBJ =& _get_validation_object()))
-		{
-			return '';
-		}
-
-		return $OBJ->error($field, $prefix, $suffix);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Validation Error String
- *
- * Returns all the errors associated with a form submission.  This is a helper
- * function for the form validation class.
- *
- * @access	public
- * @param	string
- * @param	string
- * @return	string
- */
-if ( ! function_exists('validation_errors'))
-{
-	function validation_errors($prefix = '', $suffix = '')
-	{
-		if (FALSE === ($OBJ =& _get_validation_object()))
-		{
-			return '';
-		}
-
-		return $OBJ->error_string($prefix, $suffix);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Parse the form attributes
- *
- * Helper function used by some of the form helpers
- *
- * @access	private
- * @param	array
- * @param	array
- * @return	string
- */
-if ( ! function_exists('_parse_form_attributes'))
-{
-	function _parse_form_attributes($attributes, $default)
-	{
-		if (is_array($attributes))
-		{
-			foreach ($default as $key => $val)
-			{
-				if (isset($attributes[$key]))
-				{
-					$default[$key] = $attributes[$key];
-					unset($attributes[$key]);
-				}
-			}
-
-			if (count($attributes) > 0)
-			{
-				$default = array_merge($default, $attributes);
-			}
-		}
-
-		$att = '';
-
-		foreach ($default as $key => $val)
-		{
-			if ($key == 'value')
-			{
-				$val = form_prep($val);
-			}
-
-			$att .= $key . '="' . $val . '" ';
-		}
-
-		return $att;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Attributes To String
- *
- * Helper function used by some of the form helpers
- *
- * @access	private
- * @param	mixed
- * @param	bool
- * @return	string
- */
-if ( ! function_exists('_attributes_to_string'))
-{
-	function _attributes_to_string($attributes, $formtag = FALSE)
-	{
-		if (is_string($attributes) AND strlen($attributes) > 0)
-		{
-			if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
-			{
-				$attributes .= ' method="post"';
-			}
-
-		return ' '.$attributes;
-		}
-	
-		if (is_object($attributes) AND count($attributes) > 0)
-		{
-			$attributes = (array)$attributes;
-		}
-
-		if (is_array($attributes) AND count($attributes) > 0)
-		{
-		$atts = '';
-
-		if ( ! isset($attributes['method']) AND $formtag === TRUE)
-		{
-			$atts .= ' method="post"';
-		}
-
-		foreach ($attributes as $key => $val)
-		{
-			$atts .= ' '.$key.'="'.$val.'"';
-		}
-
-		return $atts;
-		}
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Validation Object
- *
- * Determines what the form validation class was instantiated as, fetches
- * the object and returns it.
- *
- * @access	private
- * @return	mixed
- */
-if ( ! function_exists('_get_validation_object'))
-{
-	function &_get_validation_object()
-	{
-		$CI =& get_instance();
-
-		// We set this as a variable since we're returning by reference
-		$return = FALSE;
-
-		if ( ! isset($CI->load->_ci_classes) OR  ! isset($CI->load->_ci_classes['form_validation']))
-		{
-			return $return;
-		}
-
-		$object = $CI->load->_ci_classes['form_validation'];
-
-		if ( ! isset($CI->$object) OR ! is_object($CI->$object))
-		{
-			return $return;
-		}
-
-		return $CI->$object;
-	}
-}
-
-
-/* End of file form_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Form Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/form_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Declaration
+ *
+ * Creates the opening portion of the form.
+ *
+ * @access	public
+ * @param	string	the URI segments of the form destination
+ * @param	array	a key/value pair of attributes
+ * @param	array	a key/value pair hidden data
+ * @return	string
+ */	
+if ( ! function_exists('form_open'))
+{
+	function form_open($action = '', $attributes = '', $hidden = array())
+	{
+		$CI =& get_instance();
+
+		if ($attributes == '')
+		{
+			$attributes = 'method="post"';
+		}
+
+		$action = ( strpos($action, '://') === FALSE) ? $CI->config->site_url($action) : $action;
+
+		$form = '<form action="'.$action.'"';
+	
+		$form .= _attributes_to_string($attributes, TRUE);
+	
+		$form .= '>';
+
+		if (is_array($hidden) AND count($hidden) > 0)
+		{
+			$form .= form_hidden($hidden);
+		}
+
+		return $form;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Declaration - Multipart type
+ *
+ * Creates the opening portion of the form, but with "multipart/form-data".
+ *
+ * @access	public
+ * @param	string	the URI segments of the form destination
+ * @param	array	a key/value pair of attributes
+ * @param	array	a key/value pair hidden data
+ * @return	string
+ */
+if ( ! function_exists('form_open_multipart'))
+{
+	function form_open_multipart($action, $attributes = array(), $hidden = array())
+	{
+		$attributes['enctype'] = 'multipart/form-data';
+		return form_open($action, $attributes, $hidden);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Hidden Input Field
+ *
+ * Generates hidden fields.  You can pass a simple key/value string or an associative
+ * array with multiple values.
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_hidden'))
+{
+	function form_hidden($name, $value = '')
+	{
+		if ( ! is_array($name))
+		{
+			return '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
+		}
+
+		$form = '';
+
+		foreach ($name as $name => $value)
+		{
+			$form .= "\n";
+			$form .= '<input type="hidden" name="'.$name.'" value="'.form_prep($value).'" />';
+		}
+
+		return $form;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Text Input Field
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_input'))
+{
+	function form_input($data = '', $value = '', $extra = '')
+	{
+		$defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+
+		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Password Field
+ *
+ * Identical to the input function but adds the "password" type
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_password'))
+{
+	function form_password($data = '', $value = '', $extra = '')
+	{
+		if ( ! is_array($data))
+		{
+			$data = array('name' => $data);
+		}
+
+		$data['type'] = 'password';
+		return form_input($data, $value, $extra);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Upload Field
+ *
+ * Identical to the input function but adds the "file" type
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_upload'))
+{
+	function form_upload($data = '', $value = '', $extra = '')
+	{
+		if ( ! is_array($data))
+		{
+			$data = array('name' => $data);
+		}
+
+		$data['type'] = 'file';
+		return form_input($data, $value, $extra);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Textarea field
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_textarea'))
+{
+	function form_textarea($data = '', $value = '', $extra = '')
+	{
+		$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
+
+		if ( ! is_array($data) OR ! isset($data['value']))
+		{
+			$val = $value;
+		}
+		else
+		{
+			$val = $data['value']; 
+			unset($data['value']); // textareas don't use the value attribute
+		}
+
+		return "<textarea "._parse_form_attributes($data, $defaults).$extra.">".$val."</textarea>";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Drop-down Menu
+ *
+ * @access	public
+ * @param	string
+ * @param	array
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_dropdown'))
+{
+	function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '')
+	{
+		if ( ! is_array($selected))
+		{
+			$selected = array($selected);
+		}
+
+		// If no selected state was submitted we will attempt to set it automatically
+		if (count($selected) === 0)
+		{
+			// If the form name appears in the $_POST array we have a winner!
+			if (isset($_POST[$name]))
+			{
+				$selected = array($_POST[$name]);
+			}
+		}
+
+		if ($extra != '') $extra = ' '.$extra;
+
+		$multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
+
+		$form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
+	
+		foreach ($options as $key => $val)
+		{
+			$key = (string) $key;
+			$val = (string) $val;
+
+			$sel = (in_array($key, $selected))?' selected="selected"':'';
+
+			$form .= '<option value="'.$key.'"'.$sel.'>'.$val."</option>\n";
+		}
+
+		$form .= '</select>';
+
+		return $form;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Checkbox Field
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	bool
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_checkbox'))
+{
+	function form_checkbox($data = '', $value = '', $checked = FALSE, $extra = '')
+	{
+		$defaults = array('type' => 'checkbox', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+
+		if (is_array($data) AND array_key_exists('checked', $data))
+		{
+			$checked = $data['checked'];
+
+			if ($checked == FALSE)
+			{
+				unset($data['checked']);
+			}
+			else
+			{
+				$data['checked'] = 'checked';
+			}
+		}
+
+		if ($checked == TRUE)
+		{
+			$defaults['checked'] = 'checked';
+		}
+		else
+		{
+			unset($defaults['checked']);
+		}
+
+		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Radio Button
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	bool
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_radio'))
+{
+	function form_radio($data = '', $value = '', $checked = FALSE, $extra = '')
+	{
+		if ( ! is_array($data))
+		{	
+			$data = array('name' => $data);
+		}
+
+		$data['type'] = 'radio';
+		return form_checkbox($data, $value, $checked, $extra);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Submit Button
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_submit'))
+{	
+	function form_submit($data = '', $value = '', $extra = '')
+	{
+		$defaults = array('type' => 'submit', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+
+		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Reset Button
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_reset'))
+{
+	function form_reset($data = '', $value = '', $extra = '')
+	{
+		$defaults = array('type' => 'reset', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
+
+		return "<input "._parse_form_attributes($data, $defaults).$extra." />";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Button
+ *
+ * @access	public
+ * @param	mixed
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_button'))
+{
+	function form_button($data = '', $content = '', $extra = '')
+	{
+		$defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'type' => 'submit');
+
+		if ( is_array($data) AND isset($data['content']))
+		{
+			$content = $data['content'];
+			unset($data['content']); // content is not an attribute
+		}
+
+		return "<button "._parse_form_attributes($data, $defaults).$extra.">".$content."</button>";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Label Tag
+ *
+ * @access	public
+ * @param	string	The text to appear onscreen
+ * @param	string	The id the label applies to
+ * @param	string	Additional attributes
+ * @return	string
+ */
+if ( ! function_exists('form_label'))
+{
+	function form_label($label_text = '', $id = '', $attributes = array())
+	{
+
+		$label = '<label';
+
+		if ($id != '')
+		{
+			 $label .= " for=\"$id\"";
+		}
+
+		if (is_array($attributes) AND count($attributes) > 0)
+		{
+			foreach ($attributes as $key => $val)
+			{
+				$label .= ' '.$key.'="'.$val.'"';
+			}
+		}
+
+		$label .= ">$label_text</label>";
+
+		return $label;
+	}
+}
+
+// ------------------------------------------------------------------------
+/**
+ * Fieldset Tag
+ *
+ * Used to produce <fieldset><legend>text</legend>.  To close fieldset
+ * use form_fieldset_close()
+ *
+ * @access	public
+ * @param	string	The legend text
+ * @param	string	Additional attributes
+ * @return	string
+ */
+if ( ! function_exists('form_fieldset'))
+{
+	function form_fieldset($legend_text = '', $attributes = array())
+	{
+		$fieldset = "<fieldset";
+
+		$fieldset .= _attributes_to_string($attributes, FALSE);
+
+		$fieldset .= ">\n";
+
+		if ($legend_text != '')
+		{
+			$fieldset .= "<legend>$legend_text</legend>\n";
+		}
+
+		return $fieldset;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Fieldset Close Tag
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_fieldset_close'))
+{
+	function form_fieldset_close($extra = '')
+	{
+		return "</fieldset>".$extra;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Close Tag
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_close'))
+{
+	function form_close($extra = '')
+	{
+		return "</form>".$extra;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Prep
+ *
+ * Formats text so that it can be safely placed in a form field in the event it has HTML tags.
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_prep'))
+{
+	function form_prep($str = '')
+	{
+		// if the field name is an array we do this recursively
+		if (is_array($str))
+		{
+			foreach ($str as $key => $val)
+			{
+				$str[$key] = form_prep($val);
+			}
+
+			return $str;
+		}
+
+		if ($str === '')
+		{
+			return '';
+		}
+
+		$temp = '__TEMP_AMPERSANDS__';
+
+		// Replace entities to temporary markers so that 
+		// htmlspecialchars won't mess them up
+		$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
+		$str = preg_replace("/&(\w+);/",  "$temp\\1;", $str);
+
+		$str = htmlspecialchars($str);
+
+		// In case htmlspecialchars misses these.
+		$str = str_replace(array("'", '"'), array("&#39;", "&quot;"), $str);
+
+		// Decode the temp markers back to entities
+		$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
+		$str = preg_replace("/$temp(\w+);/","&\\1;",$str);
+
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Value
+ *
+ * Grabs a value from the POST array for the specified field so you can
+ * re-populate an input field or textarea.  If Form Validation
+ * is active it retrieves the info from the validation class
+ *
+ * @access	public
+ * @param	string
+ * @return	mixed
+ */
+if ( ! function_exists('set_value'))
+{
+	function set_value($field = '', $default = '')
+	{
+		if (FALSE === ($OBJ =& _get_validation_object()))
+		{
+			if ( ! isset($_POST[$field]))
+			{
+				return $default;
+			}
+
+			return form_prep($_POST[$field]);
+		}
+
+		return form_prep($OBJ->set_value($field, $default));
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Select
+ *
+ * Let's you set the selected value of a <select> menu via data in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access	public
+ * @param	string
+ * @param	string
+ * @param	bool
+ * @return	string
+ */
+if ( ! function_exists('set_select'))
+{
+	function set_select($field = '', $value = '', $default = FALSE)
+	{
+		$OBJ =& _get_validation_object();
+
+		if ($OBJ === FALSE)
+		{
+			if ( ! isset($_POST[$field]))
+			{
+				if (count($_POST) === 0)
+				{
+					return ' selected="selected"';
+				}
+				return '';
+			}
+
+			$field = $_POST[$field];
+
+			if (is_array($field))
+			{
+				if ( ! in_array($value, $field))
+				{
+					return '';
+				}
+			}
+			else
+			{
+				if (($field == '' OR $value == '') OR ($field != $value))
+				{
+					return '';
+				}
+			}
+
+			return ' selected="selected"';
+		}
+
+		return $OBJ->set_select($field, $value, $default);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Checkbox
+ *
+ * Let's you set the selected value of a checkbox via the value in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access	public
+ * @param	string
+ * @param	string
+ * @param	bool
+ * @return	string
+ */
+if ( ! function_exists('set_checkbox'))
+{
+	function set_checkbox($field = '', $value = '', $default = FALSE)
+	{
+		$OBJ =& _get_validation_object();
+
+		if ($OBJ === FALSE)
+		{ 
+			if ( ! isset($_POST[$field]))
+			{
+				if (count($_POST) === 0)
+				{
+					return ' checked="checked"';
+				}
+				return '';
+			}
+
+			$field = $_POST[$field];
+			
+			if (is_array($field))
+			{
+				if ( ! in_array($value, $field))
+				{
+					return '';
+				}
+			}
+			else
+			{
+				if (($field == '' OR $value == '') OR ($field != $value))
+				{
+					return '';
+				}
+			}
+
+			return ' checked="checked"';
+		}
+
+		return $OBJ->set_checkbox($field, $value, $default);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Radio
+ *
+ * Let's you set the selected value of a radio field via info in the POST array.
+ * If Form Validation is active it retrieves the info from the validation class
+ *
+ * @access	public
+ * @param	string
+ * @param	string
+ * @param	bool
+ * @return	string
+ */
+if ( ! function_exists('set_radio'))
+{
+	function set_radio($field = '', $value = '', $default = FALSE)
+	{
+		$OBJ =& _get_validation_object();
+
+		if ($OBJ === FALSE)
+		{
+			if ( ! isset($_POST[$field]))
+			{
+				if (count($_POST) === 0)
+				{
+					return ' checked="checked"';
+				}
+				return '';
+			}
+
+			$field = $_POST[$field];
+			
+			if (is_array($field))
+			{
+				if ( ! in_array($value, $field))
+				{
+					return '';
+				}
+			}
+			else
+			{
+				if (($field == '' OR $value == '') OR ($field != $value))
+				{
+					return '';
+				}
+			}
+
+			return ' checked="checked"';
+		}
+
+		return $OBJ->set_radio($field, $value, $default);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Form Error
+ *
+ * Returns the error for a specific form field.  This is a helper for the
+ * form validation class.
+ *
+ * @access	public
+ * @param	string
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('form_error'))
+{
+	function form_error($field = '', $prefix = '', $suffix = '')
+	{
+		if (FALSE === ($OBJ =& _get_validation_object()))
+		{
+			return '';
+		}
+
+		return $OBJ->error($field, $prefix, $suffix);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validation Error String
+ *
+ * Returns all the errors associated with a form submission.  This is a helper
+ * function for the form validation class.
+ *
+ * @access	public
+ * @param	string
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('validation_errors'))
+{
+	function validation_errors($prefix = '', $suffix = '')
+	{
+		if (FALSE === ($OBJ =& _get_validation_object()))
+		{
+			return '';
+		}
+
+		return $OBJ->error_string($prefix, $suffix);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse the form attributes
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @access	private
+ * @param	array
+ * @param	array
+ * @return	string
+ */
+if ( ! function_exists('_parse_form_attributes'))
+{
+	function _parse_form_attributes($attributes, $default)
+	{
+		if (is_array($attributes))
+		{
+			foreach ($default as $key => $val)
+			{
+				if (isset($attributes[$key]))
+				{
+					$default[$key] = $attributes[$key];
+					unset($attributes[$key]);
+				}
+			}
+
+			if (count($attributes) > 0)
+			{
+				$default = array_merge($default, $attributes);
+			}
+		}
+
+		$att = '';
+
+		foreach ($default as $key => $val)
+		{
+			if ($key == 'value')
+			{
+				$val = form_prep($val);
+			}
+
+			$att .= $key . '="' . $val . '" ';
+		}
+
+		return $att;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Attributes To String
+ *
+ * Helper function used by some of the form helpers
+ *
+ * @access	private
+ * @param	mixed
+ * @param	bool
+ * @return	string
+ */
+if ( ! function_exists('_attributes_to_string'))
+{
+	function _attributes_to_string($attributes, $formtag = FALSE)
+	{
+		if (is_string($attributes) AND strlen($attributes) > 0)
+		{
+			if ($formtag == TRUE AND strpos($attributes, 'method=') === FALSE)
+			{
+				$attributes .= ' method="post"';
+			}
+
+		return ' '.$attributes;
+		}
+	
+		if (is_object($attributes) AND count($attributes) > 0)
+		{
+			$attributes = (array)$attributes;
+		}
+
+		if (is_array($attributes) AND count($attributes) > 0)
+		{
+		$atts = '';
+
+		if ( ! isset($attributes['method']) AND $formtag === TRUE)
+		{
+			$atts .= ' method="post"';
+		}
+
+		foreach ($attributes as $key => $val)
+		{
+			$atts .= ' '.$key.'="'.$val.'"';
+		}
+
+		return $atts;
+		}
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validation Object
+ *
+ * Determines what the form validation class was instantiated as, fetches
+ * the object and returns it.
+ *
+ * @access	private
+ * @return	mixed
+ */
+if ( ! function_exists('_get_validation_object'))
+{
+	function &_get_validation_object()
+	{
+		$CI =& get_instance();
+
+		// We set this as a variable since we're returning by reference
+		$return = FALSE;
+
+		if ( ! isset($CI->load->_ci_classes) OR  ! isset($CI->load->_ci_classes['form_validation']))
+		{
+			return $return;
+		}
+
+		$object = $CI->load->_ci_classes['form_validation'];
+
+		if ( ! isset($CI->$object) OR ! is_object($CI->$object))
+		{
+			return $return;
+		}
+
+		return $CI->$object;
+	}
+}
+
+
+/* End of file form_helper.php */
 /* Location: ./system/helpers/form_helper.php */
\ No newline at end of file
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index cc34b65..e552b86 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -1,416 +1,416 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter HTML Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/html_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Heading
- *
- * Generates an HTML heading tag.  First param is the data.
- * Second param is the size of the heading tag.
- *
- * @access	public
- * @param	string
- * @param	integer
- * @return	string
- */
-if ( ! function_exists('heading'))
-{
-	function heading($data = '', $h = '1')
-	{
-		return "<h".$h.">".$data."</h".$h.">";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Unordered List
- *
- * Generates an HTML unordered list from an single or multi-dimensional array.
- *
- * @access	public
- * @param	array
- * @param	mixed
- * @return	string
- */
-if ( ! function_exists('ul'))
-{
-	function ul($list, $attributes = '')
-	{
-		return _list('ul', $list, $attributes);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Ordered List
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @access	public
- * @param	array
- * @param	mixed
- * @return	string
- */
-if ( ! function_exists('ol'))
-{
-	function ol($list, $attributes = '')
-	{
-		return _list('ol', $list, $attributes);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates the list
- *
- * Generates an HTML ordered list from an single or multi-dimensional array.
- *
- * @access	private
- * @param	string
- * @param	mixed
- * @param	mixed
- * @param	intiger
- * @return	string
- */
-if ( ! function_exists('_list'))
-{
-	function _list($type = 'ul', $list, $attributes = '', $depth = 0)
-	{
-		// If an array wasn't submitted there's nothing to do...
-		if ( ! is_array($list))
-		{
-			return $list;
-		}
-
-		// Set the indentation based on the depth
-		$out = str_repeat(" ", $depth);
-
-		// Were any attributes submitted?  If so generate a string
-		if (is_array($attributes))
-		{
-			$atts = '';
-			foreach ($attributes as $key => $val)
-			{
-				$atts .= ' ' . $key . '="' . $val . '"';
-			}
-			$attributes = $atts;
-		}
-
-		// Write the opening list tag
-		$out .= "<".$type.$attributes.">\n";
-
-		// Cycle through the list elements.  If an array is
-		// encountered we will recursively call _list()
-
-		static $_last_list_item = '';
-		foreach ($list as $key => $val)
-		{
-			$_last_list_item = $key;
-
-			$out .= str_repeat(" ", $depth + 2);
-			$out .= "<li>";
-
-			if ( ! is_array($val))
-			{
-				$out .= $val;
-			}
-			else
-			{
-				$out .= $_last_list_item."\n";
-				$out .= _list($type, $val, '', $depth + 4);
-				$out .= str_repeat(" ", $depth + 2);
-			}
-
-			$out .= "</li>\n";
-		}
-
-		// Set the indentation for the closing tag
-		$out .= str_repeat(" ", $depth);
-
-		// Write the closing list tag
-		$out .= "</".$type.">\n";
-
-		return $out;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates HTML BR tags based on number supplied
- *
- * @access	public
- * @param	integer
- * @return	string
- */
-if ( ! function_exists('br'))
-{
-	function br($num = 1)
-	{
-		return str_repeat("<br />", $num);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Image
- *
- * Generates an <img /> element
- *
- * @access	public
- * @param	mixed
- * @return	string
- */
-if ( ! function_exists('img'))
-{
-	function img($src = '', $index_page = FALSE)
-	{
-		if ( ! is_array($src) )
-		{
-			$src = array('src' => $src);
-		}
-
-		$img = '<img';
-
-		foreach ($src as $k=>$v)
-		{
-
-			if ($k == 'src' AND strpos($v, '://') === FALSE)
-			{
-				$CI =& get_instance();
-
-				if ($index_page === TRUE)
-				{
-					$img .= ' src="'.$CI->config->site_url($v).'" ';
-				}
-				else
-				{
-					$img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
-				}
-			}
-			else
-			{
-				$img .= " $k=\"$v\" ";
-			}
-		}
-
-		$img .= '/>';
-
-		return $img;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Doctype
- *
- * Generates a page document type declaration
- *
- * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame,
- * html4-strict, html4-trans, and html4-frame.  Values are saved in the
- * doctypes config file.
- *
- * @access	public
- * @param	string	type	The doctype to be generated
- * @return	string
- */
-if ( ! function_exists('doctype'))
-{
-	function doctype($type = 'xhtml-strict')
-	{
-		global $_doctypes;
-
-		if ( ! is_array($_doctypes))
-		{
-			if ( ! require_once(APPPATH.'config/doctypes.php'))
-			{
-				return FALSE;
-			}
-		}
-
-		if (isset($_doctypes[$type]))
-		{
-			return $_doctypes[$type];
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Link
- *
- * Generates link to a CSS file
- *
- * @access	public
- * @param	mixed	stylesheet hrefs or an array
- * @param	string	rel
- * @param	string	type
- * @param	string	title
- * @param	string	media
- * @param	boolean	should index_page be added to the css path
- * @return	string
- */
-if ( ! function_exists('link_tag'))
-{
-	function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
-	{
-		$CI =& get_instance();
-
-		$link = '<link ';
-
-		if (is_array($href))
-		{
-			foreach ($href as $k=>$v)
-			{
-				if ($k == 'href' AND strpos($v, '://') === FALSE)
-				{
-					if ($index_page === TRUE)
-					{
-						$link .= ' href="'.$CI->config->site_url($v).'" ';
-					}
-					else
-					{
-						$link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';
-					}
-				}
-				else
-				{
-					$link .= "$k=\"$v\" ";
-				}
-			}
-
-			$link .= "/>";
-		}
-		else
-		{
-			if ( strpos($href, '://') !== FALSE)
-			{
-				$link .= ' href="'.$href.'" ';
-			}
-			elseif ($index_page === TRUE)
-			{
-				$link .= ' href="'.$CI->config->site_url($href).'" ';
-			}
-			else
-			{
-				$link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';
-			}
-
-			$link .= 'rel="'.$rel.'" type="'.$type.'" ';
-
-			if ($media	!= '')
-			{
-				$link .= 'media="'.$media.'" ';
-			}
-
-			if ($title	!= '')
-			{
-				$link .= 'title="'.$title.'" ';
-			}
-
-			$link .= '/>';
-		}
-
-
-		return $link;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates meta tags from an array of key/values
- *
- * @access	public
- * @param	array
- * @return	string
- */
-if ( ! function_exists('meta'))
-{
-	function meta($name = '', $content = '', $type = 'name', $newline = "\n")
-	{
-		// Since we allow the data to be passes as a string, a simple array
-		// or a multidimensional one, we need to do a little prepping.
-		if ( ! is_array($name))
-		{
-			$name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
-		}
-		else
-		{
-			// Turn single array into multidimensional
-			if (isset($name['name']))
-			{
-				$name = array($name);
-			}
-		}
-
-		$str = '';
-		foreach ($name as $meta)
-		{
-			$type 		= ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
-			$name 		= ( ! isset($meta['name'])) 	? '' 	: $meta['name'];
-			$content	= ( ! isset($meta['content']))	? '' 	: $meta['content'];
-			$newline	= ( ! isset($meta['newline']))	? "\n"	: $meta['newline'];
-
-			$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
-		}
-
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Generates non-breaking space entities based on number supplied
- *
- * @access	public
- * @param	integer
- * @return	string
- */
-if ( ! function_exists('nbs'))
-{
-	function nbs($num = 1)
-	{
-		return str_repeat("&nbsp;", $num);
-	}
-}
-
-
-/* End of file html_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter HTML Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/html_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Heading
+ *
+ * Generates an HTML heading tag.  First param is the data.
+ * Second param is the size of the heading tag.
+ *
+ * @access	public
+ * @param	string
+ * @param	integer
+ * @return	string
+ */
+if ( ! function_exists('heading'))
+{
+	function heading($data = '', $h = '1')
+	{
+		return "<h".$h.">".$data."</h".$h.">";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Unordered List
+ *
+ * Generates an HTML unordered list from an single or multi-dimensional array.
+ *
+ * @access	public
+ * @param	array
+ * @param	mixed
+ * @return	string
+ */
+if ( ! function_exists('ul'))
+{
+	function ul($list, $attributes = '')
+	{
+		return _list('ul', $list, $attributes);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Ordered List
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access	public
+ * @param	array
+ * @param	mixed
+ * @return	string
+ */
+if ( ! function_exists('ol'))
+{
+	function ol($list, $attributes = '')
+	{
+		return _list('ol', $list, $attributes);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates the list
+ *
+ * Generates an HTML ordered list from an single or multi-dimensional array.
+ *
+ * @access	private
+ * @param	string
+ * @param	mixed
+ * @param	mixed
+ * @param	intiger
+ * @return	string
+ */
+if ( ! function_exists('_list'))
+{
+	function _list($type = 'ul', $list, $attributes = '', $depth = 0)
+	{
+		// If an array wasn't submitted there's nothing to do...
+		if ( ! is_array($list))
+		{
+			return $list;
+		}
+
+		// Set the indentation based on the depth
+		$out = str_repeat(" ", $depth);
+
+		// Were any attributes submitted?  If so generate a string
+		if (is_array($attributes))
+		{
+			$atts = '';
+			foreach ($attributes as $key => $val)
+			{
+				$atts .= ' ' . $key . '="' . $val . '"';
+			}
+			$attributes = $atts;
+		}
+
+		// Write the opening list tag
+		$out .= "<".$type.$attributes.">\n";
+
+		// Cycle through the list elements.  If an array is
+		// encountered we will recursively call _list()
+
+		static $_last_list_item = '';
+		foreach ($list as $key => $val)
+		{
+			$_last_list_item = $key;
+
+			$out .= str_repeat(" ", $depth + 2);
+			$out .= "<li>";
+
+			if ( ! is_array($val))
+			{
+				$out .= $val;
+			}
+			else
+			{
+				$out .= $_last_list_item."\n";
+				$out .= _list($type, $val, '', $depth + 4);
+				$out .= str_repeat(" ", $depth + 2);
+			}
+
+			$out .= "</li>\n";
+		}
+
+		// Set the indentation for the closing tag
+		$out .= str_repeat(" ", $depth);
+
+		// Write the closing list tag
+		$out .= "</".$type.">\n";
+
+		return $out;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates HTML BR tags based on number supplied
+ *
+ * @access	public
+ * @param	integer
+ * @return	string
+ */
+if ( ! function_exists('br'))
+{
+	function br($num = 1)
+	{
+		return str_repeat("<br />", $num);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Image
+ *
+ * Generates an <img /> element
+ *
+ * @access	public
+ * @param	mixed
+ * @return	string
+ */
+if ( ! function_exists('img'))
+{
+	function img($src = '', $index_page = FALSE)
+	{
+		if ( ! is_array($src) )
+		{
+			$src = array('src' => $src);
+		}
+
+		$img = '<img';
+
+		foreach ($src as $k=>$v)
+		{
+
+			if ($k == 'src' AND strpos($v, '://') === FALSE)
+			{
+				$CI =& get_instance();
+
+				if ($index_page === TRUE)
+				{
+					$img .= ' src="'.$CI->config->site_url($v).'" ';
+				}
+				else
+				{
+					$img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
+				}
+			}
+			else
+			{
+				$img .= " $k=\"$v\" ";
+			}
+		}
+
+		$img .= '/>';
+
+		return $img;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Doctype
+ *
+ * Generates a page document type declaration
+ *
+ * Valid options are xhtml-11, xhtml-strict, xhtml-trans, xhtml-frame,
+ * html4-strict, html4-trans, and html4-frame.  Values are saved in the
+ * doctypes config file.
+ *
+ * @access	public
+ * @param	string	type	The doctype to be generated
+ * @return	string
+ */
+if ( ! function_exists('doctype'))
+{
+	function doctype($type = 'xhtml-strict')
+	{
+		global $_doctypes;
+
+		if ( ! is_array($_doctypes))
+		{
+			if ( ! require_once(APPPATH.'config/doctypes.php'))
+			{
+				return FALSE;
+			}
+		}
+
+		if (isset($_doctypes[$type]))
+		{
+			return $_doctypes[$type];
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Link
+ *
+ * Generates link to a CSS file
+ *
+ * @access	public
+ * @param	mixed	stylesheet hrefs or an array
+ * @param	string	rel
+ * @param	string	type
+ * @param	string	title
+ * @param	string	media
+ * @param	boolean	should index_page be added to the css path
+ * @return	string
+ */
+if ( ! function_exists('link_tag'))
+{
+	function link_tag($href = '', $rel = 'stylesheet', $type = 'text/css', $title = '', $media = '', $index_page = FALSE)
+	{
+		$CI =& get_instance();
+
+		$link = '<link ';
+
+		if (is_array($href))
+		{
+			foreach ($href as $k=>$v)
+			{
+				if ($k == 'href' AND strpos($v, '://') === FALSE)
+				{
+					if ($index_page === TRUE)
+					{
+						$link .= ' href="'.$CI->config->site_url($v).'" ';
+					}
+					else
+					{
+						$link .= ' href="'.$CI->config->slash_item('base_url').$v.'" ';
+					}
+				}
+				else
+				{
+					$link .= "$k=\"$v\" ";
+				}
+			}
+
+			$link .= "/>";
+		}
+		else
+		{
+			if ( strpos($href, '://') !== FALSE)
+			{
+				$link .= ' href="'.$href.'" ';
+			}
+			elseif ($index_page === TRUE)
+			{
+				$link .= ' href="'.$CI->config->site_url($href).'" ';
+			}
+			else
+			{
+				$link .= ' href="'.$CI->config->slash_item('base_url').$href.'" ';
+			}
+
+			$link .= 'rel="'.$rel.'" type="'.$type.'" ';
+
+			if ($media	!= '')
+			{
+				$link .= 'media="'.$media.'" ';
+			}
+
+			if ($title	!= '')
+			{
+				$link .= 'title="'.$title.'" ';
+			}
+
+			$link .= '/>';
+		}
+
+
+		return $link;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates meta tags from an array of key/values
+ *
+ * @access	public
+ * @param	array
+ * @return	string
+ */
+if ( ! function_exists('meta'))
+{
+	function meta($name = '', $content = '', $type = 'name', $newline = "\n")
+	{
+		// Since we allow the data to be passes as a string, a simple array
+		// or a multidimensional one, we need to do a little prepping.
+		if ( ! is_array($name))
+		{
+			$name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
+		}
+		else
+		{
+			// Turn single array into multidimensional
+			if (isset($name['name']))
+			{
+				$name = array($name);
+			}
+		}
+
+		$str = '';
+		foreach ($name as $meta)
+		{
+			$type 		= ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+			$name 		= ( ! isset($meta['name'])) 	? '' 	: $meta['name'];
+			$content	= ( ! isset($meta['content']))	? '' 	: $meta['content'];
+			$newline	= ( ! isset($meta['newline']))	? "\n"	: $meta['newline'];
+
+			$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
+		}
+
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Generates non-breaking space entities based on number supplied
+ *
+ * @access	public
+ * @param	integer
+ * @return	string
+ */
+if ( ! function_exists('nbs'))
+{
+	function nbs($num = 1)
+	{
+		return str_repeat("&nbsp;", $num);
+	}
+}
+
+
+/* End of file html_helper.php */
 /* Location: ./system/helpers/html_helper.php */
\ No newline at end of file
diff --git a/system/helpers/index.html b/system/helpers/index.html
index 065d2da..c942a79 100644
--- a/system/helpers/index.html
+++ b/system/helpers/index.html
@@ -1,10 +1,10 @@
-<html>
-<head>
-	<title>403 Forbidden</title>
-</head>
-<body>
-
-<p>Directory access is forbidden.</p>
-
-</body>
+<html>
+<head>
+	<title>403 Forbidden</title>
+</head>
+<body>
+
+<p>Directory access is forbidden.</p>
+
+</body>
 </html>
\ No newline at end of file
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 8a87e50..9393f11 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -1,169 +1,169 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Inflector Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/directory_helper.html
- */
-
-
-// --------------------------------------------------------------------
-
-/**
- * Singular
- *
- * Takes a plural word and makes it singular
- *
- * @access	public
- * @param	string
- * @return	str
- */	
-if ( ! function_exists('singular'))
-{	
-	function singular($str)
-	{
-		$str = strtolower(trim($str));
-		$end = substr($str, -3);
-	
-		if ($end == 'ies')
-		{
-			$str = substr($str, 0, strlen($str)-3).'y';
-		}
-		elseif ($end == 'ses')
-		{
-			$str = substr($str, 0, strlen($str)-2);
-		}
-		else
-		{
-			$end = substr($str, -1);
-		
-			if ($end == 's')
-			{
-				$str = substr($str, 0, strlen($str)-1);
-			}
-		}
-	
-		return $str;
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Plural
- *
- * Takes a singular word and makes it plural
- *
- * @access	public
- * @param	string
- * @param	bool
- * @return	str
- */	
-if ( ! function_exists('plural'))
-{	
-	function plural($str, $force = FALSE)
-	{
-		$str = strtolower(trim($str));
-		$end = substr($str, -1);
-
-		if ($end == 'y')
-		{
-			$str = substr($str, 0, strlen($str)-1).'ies';
-		}
-		elseif ($end == 's')
-		{
-			if ($force == TRUE)
-			{
-				$str .= 'es';
-			}
-		}
-		else
-		{
-			$str .= 's';
-		}
-
-		return $str;
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Camelize
- *
- * Takes multiple words separated by spaces or underscores and camelizes them
- *
- * @access	public
- * @param	string
- * @return	str
- */	
-if ( ! function_exists('camelize'))
-{	
-	function camelize($str)
-	{		
-		$str = 'x'.strtolower(trim($str));
-		$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
-		return substr(str_replace(' ', '', $str), 1);
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Underscore
- *
- * Takes multiple words separated by spaces and underscores them
- *
- * @access	public
- * @param	string
- * @return	str
- */	
-if ( ! function_exists('underscore'))
-{
-	function underscore($str)
-	{
-		return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Humanize
- *
- * Takes multiple words separated by underscores and changes them to spaces
- *
- * @access	public
- * @param	string
- * @return	str
- */	
-if ( ! function_exists('humanize'))
-{	
-	function humanize($str)
-	{
-		return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
-	}
-}
-	
-
-/* End of file inflector_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Inflector Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/directory_helper.html
+ */
+
+
+// --------------------------------------------------------------------
+
+/**
+ * Singular
+ *
+ * Takes a plural word and makes it singular
+ *
+ * @access	public
+ * @param	string
+ * @return	str
+ */	
+if ( ! function_exists('singular'))
+{	
+	function singular($str)
+	{
+		$str = strtolower(trim($str));
+		$end = substr($str, -3);
+	
+		if ($end == 'ies')
+		{
+			$str = substr($str, 0, strlen($str)-3).'y';
+		}
+		elseif ($end == 'ses')
+		{
+			$str = substr($str, 0, strlen($str)-2);
+		}
+		else
+		{
+			$end = substr($str, -1);
+		
+			if ($end == 's')
+			{
+				$str = substr($str, 0, strlen($str)-1);
+			}
+		}
+	
+		return $str;
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Plural
+ *
+ * Takes a singular word and makes it plural
+ *
+ * @access	public
+ * @param	string
+ * @param	bool
+ * @return	str
+ */	
+if ( ! function_exists('plural'))
+{	
+	function plural($str, $force = FALSE)
+	{
+		$str = strtolower(trim($str));
+		$end = substr($str, -1);
+
+		if ($end == 'y')
+		{
+			$str = substr($str, 0, strlen($str)-1).'ies';
+		}
+		elseif ($end == 's')
+		{
+			if ($force == TRUE)
+			{
+				$str .= 'es';
+			}
+		}
+		else
+		{
+			$str .= 's';
+		}
+
+		return $str;
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Camelize
+ *
+ * Takes multiple words separated by spaces or underscores and camelizes them
+ *
+ * @access	public
+ * @param	string
+ * @return	str
+ */	
+if ( ! function_exists('camelize'))
+{	
+	function camelize($str)
+	{		
+		$str = 'x'.strtolower(trim($str));
+		$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
+		return substr(str_replace(' ', '', $str), 1);
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Underscore
+ *
+ * Takes multiple words separated by spaces and underscores them
+ *
+ * @access	public
+ * @param	string
+ * @return	str
+ */	
+if ( ! function_exists('underscore'))
+{
+	function underscore($str)
+	{
+		return preg_replace('/[\s]+/', '_', strtolower(trim($str)));
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Humanize
+ *
+ * Takes multiple words separated by underscores and changes them to spaces
+ *
+ * @access	public
+ * @param	string
+ * @return	str
+ */	
+if ( ! function_exists('humanize'))
+{	
+	function humanize($str)
+	{
+		return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str))));
+	}
+}
+	
+
+/* End of file inflector_helper.php */
 /* Location: ./system/helpers/inflector_helper.php */
\ No newline at end of file
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index d90fe31..2091fd4 100644
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
@@ -1,58 +1,58 @@
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Language Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/language_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Lang
- *
- * Fetches a language variable and optionally outputs a form label
- *
- * @access	public
- * @param	string	the language line
- * @param	string	the id of the form element
- * @return	string
- */	
-if ( ! function_exists('lang'))
-{
-	function lang($line, $id = '')
-	{
-		$CI =& get_instance();
-		$line = $CI->lang->line($line);
-
-		if ($id != '')
-		{
-			$line = '<label for="'.$id.'">'.$line."</label>";
-		}
-
-		return $line;
-	}
-}
-
-// ------------------------------------------------------------------------
-/* End of file language_helper.php */
+<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Language Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/language_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Lang
+ *
+ * Fetches a language variable and optionally outputs a form label
+ *
+ * @access	public
+ * @param	string	the language line
+ * @param	string	the id of the form element
+ * @return	string
+ */	
+if ( ! function_exists('lang'))
+{
+	function lang($line, $id = '')
+	{
+		$CI =& get_instance();
+		$line = $CI->lang->line($line);
+
+		if ($id != '')
+		{
+			$line = '<label for="'.$id.'">'.$line."</label>";
+		}
+
+		return $line;
+	}
+}
+
+// ------------------------------------------------------------------------
+/* End of file language_helper.php */
 /* Location: ./system/helpers/language_helper.php */
\ No newline at end of file
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 5b3ea1f..aeca8b2 100644
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
@@ -1,75 +1,75 @@
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Number Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/number_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Formats a numbers as bytes, based on size, and adds the appropriate suffix
- *
- * @access	public
- * @param	mixed	// will be cast as int
- * @return	string
- */
-if ( ! function_exists('byte_format'))
-{
-	function byte_format($num)
-	{
-		$CI =& get_instance();
-		$CI->lang->load('number');
-	
-		if ($num >= 1000000000000) 
-		{
-			$num = round($num / 1099511627776, 1);
-			$unit = $CI->lang->line('terabyte_abbr');
-		}
-		elseif ($num >= 1000000000) 
-		{
-			$num = round($num / 1073741824, 1);
-			$unit = $CI->lang->line('gigabyte_abbr');
-		}
-		elseif ($num >= 1000000) 
-		{
-			$num = round($num / 1048576, 1);
-			$unit = $CI->lang->line('megabyte_abbr');
-		}
-		elseif ($num >= 1000) 
-		{
-			$num = round($num / 1024, 1);
-			$unit = $CI->lang->line('kilobyte_abbr');
-		}
-		else
-		{
-			$unit = $CI->lang->line('bytes');
-			return number_format($num).' '.$unit;
-		}
-
-		return number_format($num, 1).' '.$unit;
-	}	
-}
-
-/* End of file number_helper.php */
+<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Number Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/number_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Formats a numbers as bytes, based on size, and adds the appropriate suffix
+ *
+ * @access	public
+ * @param	mixed	// will be cast as int
+ * @return	string
+ */
+if ( ! function_exists('byte_format'))
+{
+	function byte_format($num)
+	{
+		$CI =& get_instance();
+		$CI->lang->load('number');
+	
+		if ($num >= 1000000000000) 
+		{
+			$num = round($num / 1099511627776, 1);
+			$unit = $CI->lang->line('terabyte_abbr');
+		}
+		elseif ($num >= 1000000000) 
+		{
+			$num = round($num / 1073741824, 1);
+			$unit = $CI->lang->line('gigabyte_abbr');
+		}
+		elseif ($num >= 1000000) 
+		{
+			$num = round($num / 1048576, 1);
+			$unit = $CI->lang->line('megabyte_abbr');
+		}
+		elseif ($num >= 1000) 
+		{
+			$num = round($num / 1024, 1);
+			$unit = $CI->lang->line('kilobyte_abbr');
+		}
+		else
+		{
+			$unit = $CI->lang->line('bytes');
+			return number_format($num).' '.$unit;
+		}
+
+		return number_format($num, 1).' '.$unit;
+	}	
+}
+
+/* End of file number_helper.php */
 /* Location: ./system/helpers/number_helper.php */
\ No newline at end of file
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index c5ee1fb..da5df98 100644
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
@@ -1,72 +1,72 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Path Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Set Realpath
- *
- * @access	public
- * @param	string
- * @param	bool	checks to see if the path exists
- * @return	string
- */	
-if ( ! function_exists('set_realpath'))
-{
-	function set_realpath($path, $check_existance = FALSE)
-	{
-		// Security check to make sure the path is NOT a URL.  No remote file inclusion!
-		if (preg_match("#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $path))
-		{
-			show_error('The path you submitted must be a local server path, not a URL');
-		}
-	
-		// Resolve the path
-		if (function_exists('realpath') AND @realpath($path) !== FALSE)
-		{
-			$path = realpath($path).'/';
-		}
-	
-		// Add a trailing slash
-		$path = preg_replace("#([^/])/*$#", "\\1/", $path);
-	
-		// Make sure the path exists
-		if ($check_existance == TRUE)
-		{
-			if ( ! is_dir($path))
-			{
-				show_error('Not a valid path: '.$path);
-			}
-		}
-	
-		return $path;
-	}
-}
-
-
-/* End of file path_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Path Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Set Realpath
+ *
+ * @access	public
+ * @param	string
+ * @param	bool	checks to see if the path exists
+ * @return	string
+ */	
+if ( ! function_exists('set_realpath'))
+{
+	function set_realpath($path, $check_existance = FALSE)
+	{
+		// Security check to make sure the path is NOT a URL.  No remote file inclusion!
+		if (preg_match("#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i", $path))
+		{
+			show_error('The path you submitted must be a local server path, not a URL');
+		}
+	
+		// Resolve the path
+		if (function_exists('realpath') AND @realpath($path) !== FALSE)
+		{
+			$path = realpath($path).'/';
+		}
+	
+		// Add a trailing slash
+		$path = preg_replace("#([^/])/*$#", "\\1/", $path);
+	
+		// Make sure the path exists
+		if ($check_existance == TRUE)
+		{
+			if ( ! is_dir($path))
+			{
+				show_error('Not a valid path: '.$path);
+			}
+		}
+	
+		return $path;
+	}
+}
+
+
+/* End of file path_helper.php */
 /* Location: ./system/helpers/path_helper.php */
\ No newline at end of file
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index f2c5bac..0e2ba78 100644
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
@@ -1,126 +1,126 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Security Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/security_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * XSS Filtering
- *
- * @access	public
- * @param	string
- * @param	string	the character set of your data
- * @return	string
- */	
-if ( ! function_exists('xss_clean'))
-{
-	function xss_clean($str, $charset = 'ISO-8859-1')
-	{
-		$CI =& get_instance();
-		return $CI->input->xss_clean($str, $charset);
-	}
-}
-
-// --------------------------------------------------------------------
-
-/**
- * Hash encode a string
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('dohash'))
-{	
-	function dohash($str, $type = 'sha1')
-	{
-		if ($type == 'sha1')
-		{
-			if ( ! function_exists('sha1'))
-			{
-				if ( ! function_exists('mhash'))
-				{	
-					require_once(BASEPATH.'libraries/Sha1'.EXT);
-					$SH = new CI_SHA;
-					return $SH->generate($str);
-				}
-				else
-				{
-					return bin2hex(mhash(MHASH_SHA1, $str));
-				}
-			}
-			else
-			{
-				return sha1($str);
-			}	
-		}
-		else
-		{
-			return md5($str);
-		}
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Strip Image Tags
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('strip_image_tags'))
-{
-	function strip_image_tags($str)
-	{
-		$str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);
-		$str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);
-			
-		return $str;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Convert PHP tags to entities
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('encode_php_tags'))
-{
-	function encode_php_tags($str)
-	{
-		return str_replace(array('<?php', '<?PHP', '<?', '?>'),  array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
-	}
-}
-
-
-/* End of file security_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Security Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/security_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * XSS Filtering
+ *
+ * @access	public
+ * @param	string
+ * @param	string	the character set of your data
+ * @return	string
+ */	
+if ( ! function_exists('xss_clean'))
+{
+	function xss_clean($str, $charset = 'ISO-8859-1')
+	{
+		$CI =& get_instance();
+		return $CI->input->xss_clean($str, $charset);
+	}
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Hash encode a string
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('dohash'))
+{	
+	function dohash($str, $type = 'sha1')
+	{
+		if ($type == 'sha1')
+		{
+			if ( ! function_exists('sha1'))
+			{
+				if ( ! function_exists('mhash'))
+				{	
+					require_once(BASEPATH.'libraries/Sha1'.EXT);
+					$SH = new CI_SHA;
+					return $SH->generate($str);
+				}
+				else
+				{
+					return bin2hex(mhash(MHASH_SHA1, $str));
+				}
+			}
+			else
+			{
+				return sha1($str);
+			}	
+		}
+		else
+		{
+			return md5($str);
+		}
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Image Tags
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('strip_image_tags'))
+{
+	function strip_image_tags($str)
+	{
+		$str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);
+		$str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);
+			
+		return $str;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Convert PHP tags to entities
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('encode_php_tags'))
+{
+	function encode_php_tags($str)
+	{
+		return str_replace(array('<?php', '<?PHP', '<?', '?>'),  array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
+	}
+}
+
+
+/* End of file security_helper.php */
 /* Location: ./system/helpers/security_helper.php */
\ No newline at end of file
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 51c9dd0..ce7eb8b 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -1,175 +1,175 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Smiley Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/smiley_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * JS Insert Smiley
- *
- * Generates the javascrip function needed to insert smileys into a form field
- *
- * @access	public
- * @param	string	form name
- * @param	string	field name
- * @return	string
- */
-if ( ! function_exists('js_insert_smiley'))
-{
-	function js_insert_smiley($form_name = '', $form_field = '')
-	{
-		return <<<EOF
-<script type="text/javascript">
-	function insert_smiley(smiley)
-	{
-		document.{$form_name}.{$form_field}.value += " " + smiley;
-	}
-</script>
-EOF;
-	}
-}
-// ------------------------------------------------------------------------
-
-/**
- * Get Clickable Smileys
- *
- * Returns an array of image tag links that can be clicked to be inserted 
- * into a form field.  
- *
- * @access	public
- * @param	string	the URL to the folder containing the smiley images
- * @return	array
- */
-if ( ! function_exists('get_clickable_smileys'))
-{
-	function get_clickable_smileys($image_url = '', $smileys = NULL)
-	{
-		if ( ! is_array($smileys))
-		{
-			if (FALSE === ($smileys = _get_smiley_array()))
-			{
-				return $smileys;
-			}
-		}
-
-		// Add a trailing slash to the file path if needed
-		$image_url = preg_replace("/(.+?)\/*$/", "\\1/",  $image_url);
-
-		$used = array();
-		foreach ($smileys as $key => $val)
-		{
-			// Keep duplicates from being used, which can happen if the
-			// mapping array contains multiple identical replacements.  For example:
-			// :-) and :) might be replaced with the same image so both smileys
-			// will be in the array.
-			if (isset($used[$smileys[$key][0]]))
-			{
-				continue;
-			}
-
-			$link[] = "<a href=\"javascript:void(0);\" onClick=\"insert_smiley('".$key."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
-
-			$used[$smileys[$key][0]] = TRUE;
-		}
-
-		return $link;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Parse Smileys
- *
- * Takes a string as input and swaps any contained smileys for the actual image
- *
- * @access	public
- * @param	string	the text to be parsed
- * @param	string	the URL to the folder containing the smiley images
- * @return	string
- */
-if ( ! function_exists('parse_smileys'))
-{
-	function parse_smileys($str = '', $image_url = '', $smileys = NULL)
-	{
-		if ($image_url == '')
-		{
-			return $str;
-		}
-
-		if ( ! is_array($smileys))
-		{
-			if (FALSE === ($smileys = _get_smiley_array()))
-			{
-				return $str;
-			}
-		}
-
-		// Add a trailing slash to the file path if needed
-		$image_url = preg_replace("/(.+?)\/*$/", "\\1/",  $image_url);
-
-		foreach ($smileys as $key => $val)
-		{
-			$str = str_replace($key, "<img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" />", $str);
-		}
-
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Get Smiley Array
- *
- * Fetches the config/smiley.php file
- *
- * @access	private
- * @return	mixed
- */
-if ( ! function_exists('_get_smiley_array'))
-{
-	function _get_smiley_array()
-	{
-		if ( ! file_exists(APPPATH.'config/smileys'.EXT))
-		{
-			return FALSE;
-		}
-
-		include(APPPATH.'config/smileys'.EXT);
-
-		if ( ! isset($smileys) OR ! is_array($smileys))
-		{
-			return FALSE;
-		}
-
-		return $smileys;
-	}
-}
-
-
-/* End of file smiley_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Smiley Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/smiley_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * JS Insert Smiley
+ *
+ * Generates the javascrip function needed to insert smileys into a form field
+ *
+ * @access	public
+ * @param	string	form name
+ * @param	string	field name
+ * @return	string
+ */
+if ( ! function_exists('js_insert_smiley'))
+{
+	function js_insert_smiley($form_name = '', $form_field = '')
+	{
+		return <<<EOF
+<script type="text/javascript">
+	function insert_smiley(smiley)
+	{
+		document.{$form_name}.{$form_field}.value += " " + smiley;
+	}
+</script>
+EOF;
+	}
+}
+// ------------------------------------------------------------------------
+
+/**
+ * Get Clickable Smileys
+ *
+ * Returns an array of image tag links that can be clicked to be inserted 
+ * into a form field.  
+ *
+ * @access	public
+ * @param	string	the URL to the folder containing the smiley images
+ * @return	array
+ */
+if ( ! function_exists('get_clickable_smileys'))
+{
+	function get_clickable_smileys($image_url = '', $smileys = NULL)
+	{
+		if ( ! is_array($smileys))
+		{
+			if (FALSE === ($smileys = _get_smiley_array()))
+			{
+				return $smileys;
+			}
+		}
+
+		// Add a trailing slash to the file path if needed
+		$image_url = preg_replace("/(.+?)\/*$/", "\\1/",  $image_url);
+
+		$used = array();
+		foreach ($smileys as $key => $val)
+		{
+			// Keep duplicates from being used, which can happen if the
+			// mapping array contains multiple identical replacements.  For example:
+			// :-) and :) might be replaced with the same image so both smileys
+			// will be in the array.
+			if (isset($used[$smileys[$key][0]]))
+			{
+				continue;
+			}
+
+			$link[] = "<a href=\"javascript:void(0);\" onClick=\"insert_smiley('".$key."')\"><img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" /></a>";
+
+			$used[$smileys[$key][0]] = TRUE;
+		}
+
+		return $link;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse Smileys
+ *
+ * Takes a string as input and swaps any contained smileys for the actual image
+ *
+ * @access	public
+ * @param	string	the text to be parsed
+ * @param	string	the URL to the folder containing the smiley images
+ * @return	string
+ */
+if ( ! function_exists('parse_smileys'))
+{
+	function parse_smileys($str = '', $image_url = '', $smileys = NULL)
+	{
+		if ($image_url == '')
+		{
+			return $str;
+		}
+
+		if ( ! is_array($smileys))
+		{
+			if (FALSE === ($smileys = _get_smiley_array()))
+			{
+				return $str;
+			}
+		}
+
+		// Add a trailing slash to the file path if needed
+		$image_url = preg_replace("/(.+?)\/*$/", "\\1/",  $image_url);
+
+		foreach ($smileys as $key => $val)
+		{
+			$str = str_replace($key, "<img src=\"".$image_url.$smileys[$key][0]."\" width=\"".$smileys[$key][1]."\" height=\"".$smileys[$key][2]."\" alt=\"".$smileys[$key][3]."\" style=\"border:0;\" />", $str);
+		}
+
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Get Smiley Array
+ *
+ * Fetches the config/smiley.php file
+ *
+ * @access	private
+ * @return	mixed
+ */
+if ( ! function_exists('_get_smiley_array'))
+{
+	function _get_smiley_array()
+	{
+		if ( ! file_exists(APPPATH.'config/smileys'.EXT))
+		{
+			return FALSE;
+		}
+
+		include(APPPATH.'config/smileys'.EXT);
+
+		if ( ! isset($smileys) OR ! is_array($smileys))
+		{
+			return FALSE;
+		}
+
+		return $smileys;
+	}
+}
+
+
+/* End of file smiley_helper.php */
 /* Location: ./system/helpers/smiley_helper.php */
\ No newline at end of file
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 4e376a8..319002e 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -1,273 +1,273 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter String Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/string_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Trim Slashes
- *
- * Removes any leading/traling slashes from a string:
- *
- * /this/that/theother/
- *
- * becomes:
- *
- * this/that/theother
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('trim_slashes'))
-{
-	function trim_slashes($str)
-	{
-		return trim($str, '/');
-	} 
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Strip Slashes
- *
- * Removes slashes contained in a string or in an array
- *
- * @access	public
- * @param	mixed	string or array
- * @return	mixed	string or array
- */	
-if ( ! function_exists('strip_slashes'))
-{
-	function strip_slashes($str)
-	{
-		if (is_array($str))
-		{	
-			foreach ($str as $key => $val)
-			{
-				$str[$key] = strip_slashes($val);
-			}
-		}
-		else
-		{
-			$str = stripslashes($str);
-		}
-	
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Strip Quotes
- *
- * Removes single and double quotes from a string
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('strip_quotes'))
-{
-	function strip_quotes($str)
-	{
-		return str_replace(array('"', "'"), '', $str);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Quotes to Entities
- *
- * Converts single and double quotes to entities
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('quotes_to_entities'))
-{
-	function quotes_to_entities($str)
-	{	
-		return str_replace(array("\'","\"","'",'"'), array("&#39;","&quot;","&#39;","&quot;"), $str);
-	}
-}
-
-// ------------------------------------------------------------------------
-/**
- * Reduce Double Slashes
- *
- * Converts double slashes in a string to a single slash,
- * except those found in http://
- *
- * http://www.some-site.com//index.php
- *
- * becomes:
- *
- * http://www.some-site.com/index.php
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('reduce_double_slashes'))
-{
-	function reduce_double_slashes($str)
-	{
-		return preg_replace("#([^:])//+#", "\\1/", $str);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Reduce Multiples
- *
- * Reduces multiple instances of a particular character.  Example:
- *
- * Fred, Bill,, Joe, Jimmy
- *
- * becomes:
- *
- * Fred, Bill, Joe, Jimmy
- *
- * @access	public
- * @param	string
- * @param	string	the character you wish to reduce
- * @param	bool	TRUE/FALSE - whether to trim the character from the beginning/end
- * @return	string
- */	
-if ( ! function_exists('reduce_multiples'))
-{
-	function reduce_multiples($str, $character = ',', $trim = FALSE)
-	{
-		$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
-
-		if ($trim === TRUE)
-		{
-			$str = trim($str, $character);
-		}
-
-		return $str;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Create a Random String
- *
- * Useful for generating passwords or hashes.
- *
- * @access	public
- * @param	string 	type of random string.  Options: alunum, numeric, nozero, unique
- * @param	integer	number of characters
- * @return	string
- */
-if ( ! function_exists('random_string'))
-{	
-	function random_string($type = 'alnum', $len = 8)
-	{					
-		switch($type)
-		{
-			case 'alnum'	:
-			case 'numeric'	:
-			case 'nozero'	:
-		
-					switch ($type)
-					{
-						case 'alnum'	:	$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
-							break;
-						case 'numeric'	:	$pool = '0123456789';
-							break;
-						case 'nozero'	:	$pool = '123456789';
-							break;
-					}
-
-					$str = '';
-					for ($i=0; $i < $len; $i++)
-					{
-						$str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
-					}
-					return $str;
-			  break;
-			case 'unique' : return md5(uniqid(mt_rand()));
-			  break;
-		}
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Alternator
- *
- * Allows strings to be alternated.  See docs...
- *
- * @access	public
- * @param	string (as many parameters as needed)
- * @return	string
- */	
-if ( ! function_exists('alternator'))
-{
-	function alternator()
-	{
-		static $i;	
-
-		if (func_num_args() == 0)
-		{
-			$i = 0;
-			return '';
-		}
-		$args = func_get_args();
-		return $args[($i++ % count($args))];
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Repeater function
- *
- * @access	public
- * @param	string
- * @param	integer	number of repeats
- * @return	string
- */	
-if ( ! function_exists('repeater'))
-{
-	function repeater($data, $num = 1)
-	{
-		return (($num > 0) ? str_repeat($data, $num) : '');
-	} 
-}
-
-
-/* End of file string_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter String Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/string_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Trim Slashes
+ *
+ * Removes any leading/traling slashes from a string:
+ *
+ * /this/that/theother/
+ *
+ * becomes:
+ *
+ * this/that/theother
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('trim_slashes'))
+{
+	function trim_slashes($str)
+	{
+		return trim($str, '/');
+	} 
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Slashes
+ *
+ * Removes slashes contained in a string or in an array
+ *
+ * @access	public
+ * @param	mixed	string or array
+ * @return	mixed	string or array
+ */	
+if ( ! function_exists('strip_slashes'))
+{
+	function strip_slashes($str)
+	{
+		if (is_array($str))
+		{	
+			foreach ($str as $key => $val)
+			{
+				$str[$key] = strip_slashes($val);
+			}
+		}
+		else
+		{
+			$str = stripslashes($str);
+		}
+	
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Quotes
+ *
+ * Removes single and double quotes from a string
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('strip_quotes'))
+{
+	function strip_quotes($str)
+	{
+		return str_replace(array('"', "'"), '', $str);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Quotes to Entities
+ *
+ * Converts single and double quotes to entities
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('quotes_to_entities'))
+{
+	function quotes_to_entities($str)
+	{	
+		return str_replace(array("\'","\"","'",'"'), array("&#39;","&quot;","&#39;","&quot;"), $str);
+	}
+}
+
+// ------------------------------------------------------------------------
+/**
+ * Reduce Double Slashes
+ *
+ * Converts double slashes in a string to a single slash,
+ * except those found in http://
+ *
+ * http://www.some-site.com//index.php
+ *
+ * becomes:
+ *
+ * http://www.some-site.com/index.php
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('reduce_double_slashes'))
+{
+	function reduce_double_slashes($str)
+	{
+		return preg_replace("#([^:])//+#", "\\1/", $str);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Reduce Multiples
+ *
+ * Reduces multiple instances of a particular character.  Example:
+ *
+ * Fred, Bill,, Joe, Jimmy
+ *
+ * becomes:
+ *
+ * Fred, Bill, Joe, Jimmy
+ *
+ * @access	public
+ * @param	string
+ * @param	string	the character you wish to reduce
+ * @param	bool	TRUE/FALSE - whether to trim the character from the beginning/end
+ * @return	string
+ */	
+if ( ! function_exists('reduce_multiples'))
+{
+	function reduce_multiples($str, $character = ',', $trim = FALSE)
+	{
+		$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
+
+		if ($trim === TRUE)
+		{
+			$str = trim($str, $character);
+		}
+
+		return $str;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Create a Random String
+ *
+ * Useful for generating passwords or hashes.
+ *
+ * @access	public
+ * @param	string 	type of random string.  Options: alunum, numeric, nozero, unique
+ * @param	integer	number of characters
+ * @return	string
+ */
+if ( ! function_exists('random_string'))
+{	
+	function random_string($type = 'alnum', $len = 8)
+	{					
+		switch($type)
+		{
+			case 'alnum'	:
+			case 'numeric'	:
+			case 'nozero'	:
+		
+					switch ($type)
+					{
+						case 'alnum'	:	$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
+							break;
+						case 'numeric'	:	$pool = '0123456789';
+							break;
+						case 'nozero'	:	$pool = '123456789';
+							break;
+					}
+
+					$str = '';
+					for ($i=0; $i < $len; $i++)
+					{
+						$str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
+					}
+					return $str;
+			  break;
+			case 'unique' : return md5(uniqid(mt_rand()));
+			  break;
+		}
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Alternator
+ *
+ * Allows strings to be alternated.  See docs...
+ *
+ * @access	public
+ * @param	string (as many parameters as needed)
+ * @return	string
+ */	
+if ( ! function_exists('alternator'))
+{
+	function alternator()
+	{
+		static $i;	
+
+		if (func_num_args() == 0)
+		{
+			$i = 0;
+			return '';
+		}
+		$args = func_get_args();
+		return $args[($i++ % count($args))];
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Repeater function
+ *
+ * @access	public
+ * @param	string
+ * @param	integer	number of repeats
+ * @return	string
+ */	
+if ( ! function_exists('repeater'))
+{
+	function repeater($data, $num = 1)
+	{
+		return (($num > 0) ? str_repeat($data, $num) : '');
+	} 
+}
+
+
+/* End of file string_helper.php */
 /* Location: ./system/helpers/string_helper.php */
\ No newline at end of file
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 8a44608..6e61f77 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -1,443 +1,443 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Text Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/text_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Word Limiter
- *
- * Limits a string to X number of words.
- *
- * @access	public
- * @param	string
- * @param	integer
- * @param	string	the end character. Usually an ellipsis
- * @return	string
- */	
-if ( ! function_exists('word_limiter'))
-{
-	function word_limiter($str, $limit = 100, $end_char = '&#8230;')
-	{
-		if (trim($str) == '')
-		{
-			return $str;
-		}
-	
-		preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
-			
-		if (strlen($str) == strlen($matches[0]))
-		{
-			$end_char = '';
-		}
-		
-		return rtrim($matches[0]).$end_char;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Character Limiter
- *
- * Limits the string based on the character count.  Preserves complete words
- * so the character count may not be exactly as specified.
- *
- * @access	public
- * @param	string
- * @param	integer
- * @param	string	the end character. Usually an ellipsis
- * @return	string
- */	
-if ( ! function_exists('character_limiter'))
-{
-	function character_limiter($str, $n = 500, $end_char = '&#8230;')
-	{
-		if (strlen($str) < $n)
-		{
-			return $str;
-		}
-		
-		$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
-
-		if (strlen($str) <= $n)
-		{
-			return $str;
-		}
-									
-		$out = "";
-		foreach (explode(' ', trim($str)) as $val)
-		{
-			$out .= $val.' ';			
-			if (strlen($out) >= $n)
-			{
-				return trim($out).$end_char;
-			}		
-		}
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * High ASCII to Entities
- *
- * Converts High ascii text and MS Word special characters to character entities
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('ascii_to_entities'))
-{
-	function ascii_to_entities($str)
-	{
-	   $count	= 1;
-	   $out	= '';
-	   $temp	= array();
-	
-	   for ($i = 0, $s = strlen($str); $i < $s; $i++)
-	   {
-		   $ordinal = ord($str[$i]);
-	
-		   if ($ordinal < 128)
-		   {
-			   $out .= $str[$i];
-		   }
-		   else
-		   {
-			   if (count($temp) == 0)
-			   {
-				   $count = ($ordinal < 224) ? 2 : 3;
-			   }
-		
-			   $temp[] = $ordinal;
-		
-			   if (count($temp) == $count)
-			   {
-				   $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
-
-				   $out .= '&#'.$number.';';
-				   $count = 1;
-				   $temp = array();
-			   }
-		   }
-	   }
-
-	   return $out;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Entities to ASCII
- *
- * Converts character entities back to ASCII
- *
- * @access	public
- * @param	string
- * @param	bool
- * @return	string
- */	
-if ( ! function_exists('entities_to_ascii'))
-{
-	function entities_to_ascii($str, $all = TRUE)
-	{
-	   if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
-	   {
-		   for ($i = 0, $s = count($matches['0']); $i < $s; $i++)
-		   {				
-			   $digits = $matches['1'][$i];
-
-			   $out = '';
-
-			   if ($digits < 128)
-			   {
-				   $out .= chr($digits);
-		
-			   }
-			   elseif ($digits < 2048)
-			   {
-				   $out .= chr(192 + (($digits - ($digits % 64)) / 64));
-				   $out .= chr(128 + ($digits % 64));
-			   }
-			   else
-			   {
-				   $out .= chr(224 + (($digits - ($digits % 4096)) / 4096));
-				   $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64));
-				   $out .= chr(128 + ($digits % 64));
-			   }
-
-			   $str = str_replace($matches['0'][$i], $out, $str);				
-		   }
-	   }
-
-	   if ($all)
-	   {
-		   $str = str_replace(array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
-							  array("&","<",">","\"", "'", "-"),
-							  $str);
-	   }
-
-	   return $str;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Word Censoring Function
- *
- * Supply a string and an array of disallowed words and any
- * matched words will be converted to #### or to the replacement
- * word you've submitted.
- *
- * @access	public
- * @param	string	the text string
- * @param	string	the array of censoered words
- * @param	string	the optional replacement value
- * @return	string
- */	
-if ( ! function_exists('word_censor'))
-{
-	function word_censor($str, $censored, $replacement = '')
-	{
-		if ( ! is_array($censored))
-		{
-			return $str;
-		}
-
-		$str = ' '.$str.' ';
-		foreach ($censored as $badword)
-		{
-			if ($replacement != '')
-			{
-				$str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/i", $replacement, $str);
-			}
-			else
-			{
-				$str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/ie", "str_repeat('#', strlen('\\1'))", $str);
-			}
-		}
-	
-		return trim($str);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Code Highlighter
- *
- * Colorizes code strings
- *
- * @access	public
- * @param	string	the text string
- * @return	string
- */	
-if ( ! function_exists('highlight_code'))
-{
-	function highlight_code($str)
-	{		
-		// The highlight string function encodes and highlights
-		// brackets so we need them to start raw
-		$str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str);
-	
-		// Replace any existing PHP tags to temporary markers so they don't accidentally
-		// break the string out of PHP, and thus, thwart the highlighting.
-	
-		$str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'), 
-							array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str);
-
-		// The highlight_string function requires that the text be surrounded
-		// by PHP tags, which we will remove later
-		$str = '<?php '.$str.' ?>'; // <?
-
-		// All the magic happens here, baby!	
-		$str = highlight_string($str, TRUE);
-
-		// Prior to PHP 5, the highligh function used icky <font> tags
-		// so we'll replace them with <span> tags.
-
-		if (abs(PHP_VERSION) < 5)
-		{
-			$str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str);
-			$str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str);
-		}
-		
-		// Remove our artificially added PHP, and the syntax highlighting that came with it
-		$str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str);
-		$str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
-		$str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str);
-			
-		// Replace our markers back to PHP tags.
-		$str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
-							array('&lt;?', '?&gt;', '&lt;%', '%&gt;', '\\', '&lt;/script&gt;'), $str);
-										
-		return $str;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Phrase Highlighter
- *
- * Highlights a phrase within a text string
- *
- * @access	public
- * @param	string	the text string
- * @param	string	the phrase you'd like to highlight
- * @param	string	the openging tag to precede the phrase with
- * @param	string	the closing tag to end the phrase with
- * @return	string
- */	
-if ( ! function_exists('highlight_phrase'))
-{
-	function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
-	{
-		if ($str == '')
-		{
-			return '';
-		}
-	
-		if ($phrase != '')
-		{
-			return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open."\\1".$tag_close, $str);
-		}
-
-		return $str;
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Word Wrap
- *
- * Wraps text at the specified character.  Maintains the integrity of words.
- * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
- * will URLs.
- *
- * @access	public
- * @param	string	the text string
- * @param	integer	the number of characters to wrap at
- * @return	string
- */	
-if ( ! function_exists('word_wrap'))
-{
-	function word_wrap($str, $charlim = '76')
-	{
-		// Se the character limit
-		if ( ! is_numeric($charlim))
-			$charlim = 76;
-	
-		// Reduce multiple spaces
-		$str = preg_replace("| +|", " ", $str);
-	
-		// Standardize newlines
-		if (strpos($str, "\r") !== FALSE)
-		{
-			$str = str_replace(array("\r\n", "\r"), "\n", $str);			
-		}
-	
-		// If the current word is surrounded by {unwrap} tags we'll 
-		// strip the entire chunk and replace it with a marker.
-		$unwrap = array();
-		if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches))
-		{
-			for ($i = 0; $i < count($matches['0']); $i++)
-			{
-				$unwrap[] = $matches['1'][$i];				
-				$str = str_replace($matches['1'][$i], "{{unwrapped".$i."}}", $str);
-			}
-		}
-	
-		// Use PHP's native function to do the initial wordwrap.  
-		// We set the cut flag to FALSE so that any individual words that are 
-		// too long get left alone.  In the next step we'll deal with them.
-		$str = wordwrap($str, $charlim, "\n", FALSE);
-	
-		// Split the string into individual lines of text and cycle through them
-		$output = "";
-		foreach (explode("\n", $str) as $line) 
-		{
-			// Is the line within the allowed character count?
-			// If so we'll join it to the output and continue
-			if (strlen($line) <= $charlim)
-			{
-				$output .= $line."\n";			
-				continue;
-			}
-			
-			$temp = '';
-			while((strlen($line)) > $charlim) 
-			{
-				// If the over-length word is a URL we won't wrap it
-				if (preg_match("!\[url.+\]|://|wwww.!", $line))
-				{
-					break;
-				}
-
-				// Trim the word down
-				$temp .= substr($line, 0, $charlim-1);
-				$line = substr($line, $charlim-1);
-			}
-		
-			// If $temp contains data it means we had to split up an over-length 
-			// word into smaller chunks so we'll add it back to our current line
-			if ($temp != '')
-			{
-				$output .= $temp . "\n" . $line; 
-			}
-			else
-			{
-				$output .= $line;
-			}
-
-			$output .= "\n";
-		}
-
-		// Put our markers back
-		if (count($unwrap) > 0)
-		{	
-			foreach ($unwrap as $key => $val)
-			{
-				$output = str_replace("{{unwrapped".$key."}}", $val, $output);
-			}
-		}
-
-		// Remove the unwrap tags
-		$output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
-
-		return $output;	
-	}
-}
-
-
-/* End of file text_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Text Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/text_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Word Limiter
+ *
+ * Limits a string to X number of words.
+ *
+ * @access	public
+ * @param	string
+ * @param	integer
+ * @param	string	the end character. Usually an ellipsis
+ * @return	string
+ */	
+if ( ! function_exists('word_limiter'))
+{
+	function word_limiter($str, $limit = 100, $end_char = '&#8230;')
+	{
+		if (trim($str) == '')
+		{
+			return $str;
+		}
+	
+		preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
+			
+		if (strlen($str) == strlen($matches[0]))
+		{
+			$end_char = '';
+		}
+		
+		return rtrim($matches[0]).$end_char;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Character Limiter
+ *
+ * Limits the string based on the character count.  Preserves complete words
+ * so the character count may not be exactly as specified.
+ *
+ * @access	public
+ * @param	string
+ * @param	integer
+ * @param	string	the end character. Usually an ellipsis
+ * @return	string
+ */	
+if ( ! function_exists('character_limiter'))
+{
+	function character_limiter($str, $n = 500, $end_char = '&#8230;')
+	{
+		if (strlen($str) < $n)
+		{
+			return $str;
+		}
+		
+		$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
+
+		if (strlen($str) <= $n)
+		{
+			return $str;
+		}
+									
+		$out = "";
+		foreach (explode(' ', trim($str)) as $val)
+		{
+			$out .= $val.' ';			
+			if (strlen($out) >= $n)
+			{
+				return trim($out).$end_char;
+			}		
+		}
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * High ASCII to Entities
+ *
+ * Converts High ascii text and MS Word special characters to character entities
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('ascii_to_entities'))
+{
+	function ascii_to_entities($str)
+	{
+	   $count	= 1;
+	   $out	= '';
+	   $temp	= array();
+	
+	   for ($i = 0, $s = strlen($str); $i < $s; $i++)
+	   {
+		   $ordinal = ord($str[$i]);
+	
+		   if ($ordinal < 128)
+		   {
+			   $out .= $str[$i];
+		   }
+		   else
+		   {
+			   if (count($temp) == 0)
+			   {
+				   $count = ($ordinal < 224) ? 2 : 3;
+			   }
+		
+			   $temp[] = $ordinal;
+		
+			   if (count($temp) == $count)
+			   {
+				   $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+
+				   $out .= '&#'.$number.';';
+				   $count = 1;
+				   $temp = array();
+			   }
+		   }
+	   }
+
+	   return $out;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Entities to ASCII
+ *
+ * Converts character entities back to ASCII
+ *
+ * @access	public
+ * @param	string
+ * @param	bool
+ * @return	string
+ */	
+if ( ! function_exists('entities_to_ascii'))
+{
+	function entities_to_ascii($str, $all = TRUE)
+	{
+	   if (preg_match_all('/\&#(\d+)\;/', $str, $matches))
+	   {
+		   for ($i = 0, $s = count($matches['0']); $i < $s; $i++)
+		   {				
+			   $digits = $matches['1'][$i];
+
+			   $out = '';
+
+			   if ($digits < 128)
+			   {
+				   $out .= chr($digits);
+		
+			   }
+			   elseif ($digits < 2048)
+			   {
+				   $out .= chr(192 + (($digits - ($digits % 64)) / 64));
+				   $out .= chr(128 + ($digits % 64));
+			   }
+			   else
+			   {
+				   $out .= chr(224 + (($digits - ($digits % 4096)) / 4096));
+				   $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64));
+				   $out .= chr(128 + ($digits % 64));
+			   }
+
+			   $str = str_replace($matches['0'][$i], $out, $str);				
+		   }
+	   }
+
+	   if ($all)
+	   {
+		   $str = str_replace(array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"),
+							  array("&","<",">","\"", "'", "-"),
+							  $str);
+	   }
+
+	   return $str;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Word Censoring Function
+ *
+ * Supply a string and an array of disallowed words and any
+ * matched words will be converted to #### or to the replacement
+ * word you've submitted.
+ *
+ * @access	public
+ * @param	string	the text string
+ * @param	string	the array of censoered words
+ * @param	string	the optional replacement value
+ * @return	string
+ */	
+if ( ! function_exists('word_censor'))
+{
+	function word_censor($str, $censored, $replacement = '')
+	{
+		if ( ! is_array($censored))
+		{
+			return $str;
+		}
+
+		$str = ' '.$str.' ';
+		foreach ($censored as $badword)
+		{
+			if ($replacement != '')
+			{
+				$str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/i", $replacement, $str);
+			}
+			else
+			{
+				$str = preg_replace("/\b(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")\b/ie", "str_repeat('#', strlen('\\1'))", $str);
+			}
+		}
+	
+		return trim($str);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Code Highlighter
+ *
+ * Colorizes code strings
+ *
+ * @access	public
+ * @param	string	the text string
+ * @return	string
+ */	
+if ( ! function_exists('highlight_code'))
+{
+	function highlight_code($str)
+	{		
+		// The highlight string function encodes and highlights
+		// brackets so we need them to start raw
+		$str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str);
+	
+		// Replace any existing PHP tags to temporary markers so they don't accidentally
+		// break the string out of PHP, and thus, thwart the highlighting.
+	
+		$str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'), 
+							array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str);
+
+		// The highlight_string function requires that the text be surrounded
+		// by PHP tags, which we will remove later
+		$str = '<?php '.$str.' ?>'; // <?
+
+		// All the magic happens here, baby!	
+		$str = highlight_string($str, TRUE);
+
+		// Prior to PHP 5, the highligh function used icky <font> tags
+		// so we'll replace them with <span> tags.
+
+		if (abs(PHP_VERSION) < 5)
+		{
+			$str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str);
+			$str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str);
+		}
+		
+		// Remove our artificially added PHP, and the syntax highlighting that came with it
+		$str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str);
+		$str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str);
+		$str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str);
+			
+		// Replace our markers back to PHP tags.
+		$str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'),
+							array('&lt;?', '?&gt;', '&lt;%', '%&gt;', '\\', '&lt;/script&gt;'), $str);
+										
+		return $str;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Phrase Highlighter
+ *
+ * Highlights a phrase within a text string
+ *
+ * @access	public
+ * @param	string	the text string
+ * @param	string	the phrase you'd like to highlight
+ * @param	string	the openging tag to precede the phrase with
+ * @param	string	the closing tag to end the phrase with
+ * @return	string
+ */	
+if ( ! function_exists('highlight_phrase'))
+{
+	function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>')
+	{
+		if ($str == '')
+		{
+			return '';
+		}
+	
+		if ($phrase != '')
+		{
+			return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open."\\1".$tag_close, $str);
+		}
+
+		return $str;
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Word Wrap
+ *
+ * Wraps text at the specified character.  Maintains the integrity of words.
+ * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor
+ * will URLs.
+ *
+ * @access	public
+ * @param	string	the text string
+ * @param	integer	the number of characters to wrap at
+ * @return	string
+ */	
+if ( ! function_exists('word_wrap'))
+{
+	function word_wrap($str, $charlim = '76')
+	{
+		// Se the character limit
+		if ( ! is_numeric($charlim))
+			$charlim = 76;
+	
+		// Reduce multiple spaces
+		$str = preg_replace("| +|", " ", $str);
+	
+		// Standardize newlines
+		if (strpos($str, "\r") !== FALSE)
+		{
+			$str = str_replace(array("\r\n", "\r"), "\n", $str);			
+		}
+	
+		// If the current word is surrounded by {unwrap} tags we'll 
+		// strip the entire chunk and replace it with a marker.
+		$unwrap = array();
+		if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches))
+		{
+			for ($i = 0; $i < count($matches['0']); $i++)
+			{
+				$unwrap[] = $matches['1'][$i];				
+				$str = str_replace($matches['1'][$i], "{{unwrapped".$i."}}", $str);
+			}
+		}
+	
+		// Use PHP's native function to do the initial wordwrap.  
+		// We set the cut flag to FALSE so that any individual words that are 
+		// too long get left alone.  In the next step we'll deal with them.
+		$str = wordwrap($str, $charlim, "\n", FALSE);
+	
+		// Split the string into individual lines of text and cycle through them
+		$output = "";
+		foreach (explode("\n", $str) as $line) 
+		{
+			// Is the line within the allowed character count?
+			// If so we'll join it to the output and continue
+			if (strlen($line) <= $charlim)
+			{
+				$output .= $line."\n";			
+				continue;
+			}
+			
+			$temp = '';
+			while((strlen($line)) > $charlim) 
+			{
+				// If the over-length word is a URL we won't wrap it
+				if (preg_match("!\[url.+\]|://|wwww.!", $line))
+				{
+					break;
+				}
+
+				// Trim the word down
+				$temp .= substr($line, 0, $charlim-1);
+				$line = substr($line, $charlim-1);
+			}
+		
+			// If $temp contains data it means we had to split up an over-length 
+			// word into smaller chunks so we'll add it back to our current line
+			if ($temp != '')
+			{
+				$output .= $temp . "\n" . $line; 
+			}
+			else
+			{
+				$output .= $line;
+			}
+
+			$output .= "\n";
+		}
+
+		// Put our markers back
+		if (count($unwrap) > 0)
+		{	
+			foreach ($unwrap as $key => $val)
+			{
+				$output = str_replace("{{unwrapped".$key."}}", $val, $output);
+			}
+		}
+
+		// Remove the unwrap tags
+		$output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
+
+		return $output;	
+	}
+}
+
+
+/* End of file text_helper.php */
 /* Location: ./system/helpers/text_helper.php */
\ No newline at end of file
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index d3cc7f1..46fe6bf 100644
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
@@ -1,71 +1,71 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter Typography Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/typography_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Convert newlines to HTML line breaks except within PRE tags
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('nl2br_except_pre'))
-{
-	function nl2br_except_pre($str)
-	{
-		$CI =& get_instance();
-	
-		$CI->load->library('typography');
-		
-		return $CI->typography->nl2br_except_pre($str);
-	}
-}
-	
-// ------------------------------------------------------------------------
-
-/**
- * Auto Typography Wrapper Function
- *
- *
- * @access	public
- * @param	string
- * @param	bool	whether to reduce multiple instances of double newlines to two
- * @return	string
- */
-if ( ! function_exists('auto_typography'))
-{
-	function auto_typography($str, $reduce_linebreaks = FALSE)
-	{
-		$CI =& get_instance();	
-		$CI->load->library('typography');
-		return $CI->typography->auto_typography($str, $reduce_linebreaks);
-	}
-}
-
-/* End of file typography_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Typography Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/typography_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Convert newlines to HTML line breaks except within PRE tags
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('nl2br_except_pre'))
+{
+	function nl2br_except_pre($str)
+	{
+		$CI =& get_instance();
+	
+		$CI->load->library('typography');
+		
+		return $CI->typography->nl2br_except_pre($str);
+	}
+}
+	
+// ------------------------------------------------------------------------
+
+/**
+ * Auto Typography Wrapper Function
+ *
+ *
+ * @access	public
+ * @param	string
+ * @param	bool	whether to reduce multiple instances of double newlines to two
+ * @return	string
+ */
+if ( ! function_exists('auto_typography'))
+{
+	function auto_typography($str, $reduce_linebreaks = FALSE)
+	{
+		$CI =& get_instance();	
+		$CI->load->library('typography');
+		return $CI->typography->auto_typography($str, $reduce_linebreaks);
+	}
+}
+
+/* End of file typography_helper.php */
 /* Location: ./system/helpers/typography_helper.php */
\ No newline at end of file
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 744295f..fd13dc2 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -1,582 +1,582 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter URL Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/url_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Site URL
- *
- * Create a local URL based on your basepath. Segments can be passed via the
- * first parameter either as a string or an array.
- *
- * @access	public
- * @param	string
- * @return	string
- */
-if ( ! function_exists('site_url'))
-{
-	function site_url($uri = '')
-	{
-		$CI =& get_instance();
-		return $CI->config->site_url($uri);
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Base URL
- *
- * Returns the "base_url" item from your config file
- *
- * @access	public
- * @return	string
- */
-if ( ! function_exists('base_url'))
-{
-	function base_url()
-	{
-		$CI =& get_instance();
-		return $CI->config->slash_item('base_url');
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Current URL
- *
- * Returns the full URL (including segments) of the page where this 
- * function is placed
- *
- * @access	public
- * @return	string
- */
-if ( ! function_exists('current_url'))
-{
-	function current_url()
-	{
-		$CI =& get_instance();
-		return $CI->config->site_url($CI->uri->uri_string());
-	}
-}
-
-// ------------------------------------------------------------------------
-/**
- * URL String
- *
- * Returns the URI segments.
- *
- * @access	public
- * @return	string
- */
-if ( ! function_exists('uri_string'))
-{
-	function uri_string()
-	{
-		$CI =& get_instance();
-		return $CI->uri->uri_string();
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Index page
- *
- * Returns the "index_page" from your config file
- *
- * @access	public
- * @return	string
- */
-if ( ! function_exists('index_page'))
-{
-	function index_page()
-	{
-		$CI =& get_instance();
-		return $CI->config->item('index_page');
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Anchor Link
- *
- * Creates an anchor based on the local URL.
- *
- * @access	public
- * @param	string	the URL
- * @param	string	the link title
- * @param	mixed	any attributes
- * @return	string
- */
-if ( ! function_exists('anchor'))
-{
-	function anchor($uri = '', $title = '', $attributes = '')
-	{
-		$title = (string) $title;
-
-		if ( ! is_array($uri))
-		{
-			$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
-		}
-		else
-		{
-			$site_url = site_url($uri);
-		}
-
-		if ($title == '')
-		{
-			$title = $site_url;
-		}
-
-		if ($attributes != '')
-		{
-			$attributes = _parse_attributes($attributes);
-		}
-
-		return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>';
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Anchor Link - Pop-up version
- *
- * Creates an anchor based on the local URL. The link
- * opens a new window based on the attributes specified.
- *
- * @access	public
- * @param	string	the URL
- * @param	string	the link title
- * @param	mixed	any attributes
- * @return	string
- */
-if ( ! function_exists('anchor_popup'))
-{
-	function anchor_popup($uri = '', $title = '', $attributes = FALSE)
-	{
-		$title = (string) $title;
-
-		$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
-
-		if ($title == '')
-		{
-			$title = $site_url;
-		}
-
-		if ($attributes === FALSE)
-		{
-			return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title."</a>";
-		}
-
-		if ( ! is_array($attributes))
-		{
-			$attributes = array();
-		}
-
-		foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val)
-		{
-			$atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key];
-			unset($attributes[$key]);
-		}
-
-		if ($attributes != '')
-		{
-			$attributes = _parse_attributes($attributes);
-		}
-
-		return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"$attributes>".$title."</a>";
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Mailto Link
- *
- * @access	public
- * @param	string	the email address
- * @param	string	the link title
- * @param	mixed 	any attributes
- * @return	string
- */
-if ( ! function_exists('mailto'))
-{
-	function mailto($email, $title = '', $attributes = '')
-	{
-		$title = (string) $title;
-
-		if ($title == "")
-		{
-			$title = $email;
-		}
-
-		$attributes = _parse_attributes($attributes);
-
-		return '<a href="mailto:'.$email.'"'.$attributes.'>'.$title.'</a>';
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Encoded Mailto Link
- *
- * Create a spam-protected mailto link written in Javascript
- *
- * @access	public
- * @param	string	the email address
- * @param	string	the link title
- * @param	mixed 	any attributes
- * @return	string
- */
-if ( ! function_exists('safe_mailto'))
-{
-	function safe_mailto($email, $title = '', $attributes = '')
-	{
-		$title = (string) $title;
-
-		if ($title == "")
-		{
-			$title = $email;
-		}
-
-		for ($i = 0; $i < 16; $i++)
-		{
-			$x[] = substr('<a href="mailto:', $i, 1);
-		}
-
-		for ($i = 0; $i < strlen($email); $i++)
-		{
-			$x[] = "|".ord(substr($email, $i, 1));
-		}
-
-		$x[] = '"';
-
-		if ($attributes != '')
-		{
-			if (is_array($attributes))
-			{
-				foreach ($attributes as $key => $val)
-				{
-					$x[] =  ' '.$key.'="';
-					for ($i = 0; $i < strlen($val); $i++)
-					{
-						$x[] = "|".ord(substr($val, $i, 1));
-					}
-					$x[] = '"';
-				}
-			}
-			else
-			{
-				for ($i = 0; $i < strlen($attributes); $i++)
-				{
-					$x[] = substr($attributes, $i, 1);
-				}
-			}
-		}
-
-		$x[] = '>';
-
-		$temp = array();
-		for ($i = 0; $i < strlen($title); $i++)
-		{
-			$ordinal = ord($title[$i]);
-
-			if ($ordinal < 128)
-			{
-				$x[] = "|".$ordinal;
-			}
-			else
-			{
-				if (count($temp) == 0)
-				{
-					$count = ($ordinal < 224) ? 2 : 3;
-				}
-	
-				$temp[] = $ordinal;
-				if (count($temp) == $count)
-				{
-					$number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
-					$x[] = "|".$number;
-					$count = 1;
-					$temp = array();
-				}
-			}
-		}
-
-		$x[] = '<'; $x[] = '/'; $x[] = 'a'; $x[] = '>';
-
-		$x = array_reverse($x);
-		ob_start();
-
-	?><script type="text/javascript">
-	//<![CDATA[
-	var l=new Array();
-	<?php
-	$i = 0;
-	foreach ($x as $val){ ?>l[<?php echo $i++; ?>]='<?php echo $val; ?>';<?php } ?>
-
-	for (var i = l.length-1; i >= 0; i=i-1){
-	if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";");
-	else document.write(unescape(l[i]));}
-	//]]>
-	</script><?php
-
-		$buffer = ob_get_contents();
-		ob_end_clean();
-		return $buffer;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Auto-linker
- *
- * Automatically links URL and Email addresses.
- * Note: There's a bit of extra code here to deal with
- * URLs or emails that end in a period.  We'll strip these
- * off and add them after the link.
- *
- * @access	public
- * @param	string	the string
- * @param	string	the type: email, url, or both
- * @param	bool 	whether to create pop-up links
- * @return	string
- */
-if ( ! function_exists('auto_link'))
-{
-	function auto_link($str, $type = 'both', $popup = FALSE)
-	{
-		if ($type != 'email')
-		{
-			if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
-			{
-				$pop = ($popup == TRUE) ? " target=\"_blank\" " : "";
-	
-				for ($i = 0; $i < sizeof($matches['0']); $i++)
-				{
-					$period = '';
-					if (preg_match("|\.$|", $matches['6'][$i]))
-					{
-						$period = '.';
-						$matches['6'][$i] = substr($matches['6'][$i], 0, -1);
-					}
-		
-					$str = str_replace($matches['0'][$i],
-										$matches['1'][$i].'<a href="http'.
-										$matches['4'][$i].'://'.
-										$matches['5'][$i].
-										$matches['6'][$i].'"'.$pop.'>http'.
-										$matches['4'][$i].'://'.
-										$matches['5'][$i].
-										$matches['6'][$i].'</a>'.
-										$period, $str);
-				}
-			}
-		}
-
-		if ($type != 'url')
-		{
-			if (preg_match_all("/([a-zA-Z0-9_\.\-\+Å]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i", $str, $matches))
-			{
-				for ($i = 0; $i < sizeof($matches['0']); $i++)
-				{
-					$period = '';
-					if (preg_match("|\.$|", $matches['3'][$i]))
-					{
-						$period = '.';
-						$matches['3'][$i] = substr($matches['3'][$i], 0, -1);
-					}
-		
-					$str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str);
-				}
-			}
-		}
-
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Prep URL
- *
- * Simply adds the http:// part if missing
- *
- * @access	public
- * @param	string	the URL
- * @return	string
- */
-if ( ! function_exists('prep_url'))
-{
-	function prep_url($str = '')
-	{
-		if ($str == 'http://' OR $str == '')
-		{
-			return '';
-		}
-
-		if (substr($str, 0, 7) != 'http://' && substr($str, 0, 8) != 'https://')
-		{
-			$str = 'http://'.$str;
-		}
-
-		return $str;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Create URL Title
- *
- * Takes a "title" string as input and creates a
- * human-friendly URL string with either a dash
- * or an underscore as the word separator.
- *
- * @access	public
- * @param	string	the string
- * @param	string	the separator: dash, or underscore
- * @return	string
- */
-if ( ! function_exists('url_title'))
-{
-	function url_title($str, $separator = 'dash')
-	{
-		if ($separator == 'dash')
-		{
-			$search		= '_';
-			$replace	= '-';
-		}
-		else
-		{
-			$search		= '-';
-			$replace	= '_';
-		}
-
-		$trans = array(
-						'&\#\d+?;'				=> '',
-						'&\S+?;'				=> '',
-						'\s+'					=> $replace,
-						'[^a-z0-9\-\._]'		=> '',
-						$replace.'+'			=> $replace,
-						$replace.'$'			=> $replace,
-						'^'.$replace			=> $replace
-					  );
-
-		$str = strip_tags($str);
-
-		foreach ($trans as $key => $val)
-		{
-			$str = preg_replace("#".$key."#i", $val, $str);
-		}
-
-		return trim(stripslashes($str));
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Header Redirect
- *
- * Header redirect in two flavors
- * For very fine grained control over headers, you could use the Output
- * Library's set_header() function.
- *
- * @access	public
- * @param	string	the URL
- * @param	string	the method: location or redirect
- * @return	string
- */
-if ( ! function_exists('redirect'))
-{
-	function redirect($uri = '', $method = 'location', $http_response_code = 302)
-	{
-		switch($method)
-		{
-			case 'refresh'	: header("Refresh:0;url=".site_url($uri));
-				break;
-			default			: header("Location: ".site_url($uri), TRUE, $http_response_code);
-				break;
-		}
-		exit;
-	}
-}
-
-// ------------------------------------------------------------------------
-
-/**
- * Parse out the attributes
- *
- * Some of the functions use this
- *
- * @access	private
- * @param	array
- * @param	bool
- * @return	string
- */
-if ( ! function_exists('_parse_attributes'))
-{
-	function _parse_attributes($attributes, $javascript = FALSE)
-	{
-		if (is_string($attributes))
-		{
-			return ($attributes != '') ? ' '.$attributes : '';
-		}
-
-		$att = '';
-		foreach ($attributes as $key => $val)
-		{
-			if ($javascript == TRUE)
-			{
-				$att .= $key . '=' . $val . ',';
-			}
-			else
-			{
-				$att .= ' ' . $key . '="' . $val . '"';
-			}
-		}
-
-		if ($javascript == TRUE AND $att != '')
-		{
-			$att = substr($att, 0, -1);
-		}
-
-		return $att;
-	}
-}
-
-
-/* End of file url_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter URL Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/url_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Site URL
+ *
+ * Create a local URL based on your basepath. Segments can be passed via the
+ * first parameter either as a string or an array.
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */
+if ( ! function_exists('site_url'))
+{
+	function site_url($uri = '')
+	{
+		$CI =& get_instance();
+		return $CI->config->site_url($uri);
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Base URL
+ *
+ * Returns the "base_url" item from your config file
+ *
+ * @access	public
+ * @return	string
+ */
+if ( ! function_exists('base_url'))
+{
+	function base_url()
+	{
+		$CI =& get_instance();
+		return $CI->config->slash_item('base_url');
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Current URL
+ *
+ * Returns the full URL (including segments) of the page where this 
+ * function is placed
+ *
+ * @access	public
+ * @return	string
+ */
+if ( ! function_exists('current_url'))
+{
+	function current_url()
+	{
+		$CI =& get_instance();
+		return $CI->config->site_url($CI->uri->uri_string());
+	}
+}
+
+// ------------------------------------------------------------------------
+/**
+ * URL String
+ *
+ * Returns the URI segments.
+ *
+ * @access	public
+ * @return	string
+ */
+if ( ! function_exists('uri_string'))
+{
+	function uri_string()
+	{
+		$CI =& get_instance();
+		return $CI->uri->uri_string();
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Index page
+ *
+ * Returns the "index_page" from your config file
+ *
+ * @access	public
+ * @return	string
+ */
+if ( ! function_exists('index_page'))
+{
+	function index_page()
+	{
+		$CI =& get_instance();
+		return $CI->config->item('index_page');
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Anchor Link
+ *
+ * Creates an anchor based on the local URL.
+ *
+ * @access	public
+ * @param	string	the URL
+ * @param	string	the link title
+ * @param	mixed	any attributes
+ * @return	string
+ */
+if ( ! function_exists('anchor'))
+{
+	function anchor($uri = '', $title = '', $attributes = '')
+	{
+		$title = (string) $title;
+
+		if ( ! is_array($uri))
+		{
+			$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
+		}
+		else
+		{
+			$site_url = site_url($uri);
+		}
+
+		if ($title == '')
+		{
+			$title = $site_url;
+		}
+
+		if ($attributes != '')
+		{
+			$attributes = _parse_attributes($attributes);
+		}
+
+		return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>';
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Anchor Link - Pop-up version
+ *
+ * Creates an anchor based on the local URL. The link
+ * opens a new window based on the attributes specified.
+ *
+ * @access	public
+ * @param	string	the URL
+ * @param	string	the link title
+ * @param	mixed	any attributes
+ * @return	string
+ */
+if ( ! function_exists('anchor_popup'))
+{
+	function anchor_popup($uri = '', $title = '', $attributes = FALSE)
+	{
+		$title = (string) $title;
+
+		$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
+
+		if ($title == '')
+		{
+			$title = $site_url;
+		}
+
+		if ($attributes === FALSE)
+		{
+			return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank');\">".$title."</a>";
+		}
+
+		if ( ! is_array($attributes))
+		{
+			$attributes = array();
+		}
+
+		foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val)
+		{
+			$atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key];
+			unset($attributes[$key]);
+		}
+
+		if ($attributes != '')
+		{
+			$attributes = _parse_attributes($attributes);
+		}
+
+		return "<a href='javascript:void(0);' onclick=\"window.open('".$site_url."', '_blank', '"._parse_attributes($atts, TRUE)."');\"$attributes>".$title."</a>";
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Mailto Link
+ *
+ * @access	public
+ * @param	string	the email address
+ * @param	string	the link title
+ * @param	mixed 	any attributes
+ * @return	string
+ */
+if ( ! function_exists('mailto'))
+{
+	function mailto($email, $title = '', $attributes = '')
+	{
+		$title = (string) $title;
+
+		if ($title == "")
+		{
+			$title = $email;
+		}
+
+		$attributes = _parse_attributes($attributes);
+
+		return '<a href="mailto:'.$email.'"'.$attributes.'>'.$title.'</a>';
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Encoded Mailto Link
+ *
+ * Create a spam-protected mailto link written in Javascript
+ *
+ * @access	public
+ * @param	string	the email address
+ * @param	string	the link title
+ * @param	mixed 	any attributes
+ * @return	string
+ */
+if ( ! function_exists('safe_mailto'))
+{
+	function safe_mailto($email, $title = '', $attributes = '')
+	{
+		$title = (string) $title;
+
+		if ($title == "")
+		{
+			$title = $email;
+		}
+
+		for ($i = 0; $i < 16; $i++)
+		{
+			$x[] = substr('<a href="mailto:', $i, 1);
+		}
+
+		for ($i = 0; $i < strlen($email); $i++)
+		{
+			$x[] = "|".ord(substr($email, $i, 1));
+		}
+
+		$x[] = '"';
+
+		if ($attributes != '')
+		{
+			if (is_array($attributes))
+			{
+				foreach ($attributes as $key => $val)
+				{
+					$x[] =  ' '.$key.'="';
+					for ($i = 0; $i < strlen($val); $i++)
+					{
+						$x[] = "|".ord(substr($val, $i, 1));
+					}
+					$x[] = '"';
+				}
+			}
+			else
+			{
+				for ($i = 0; $i < strlen($attributes); $i++)
+				{
+					$x[] = substr($attributes, $i, 1);
+				}
+			}
+		}
+
+		$x[] = '>';
+
+		$temp = array();
+		for ($i = 0; $i < strlen($title); $i++)
+		{
+			$ordinal = ord($title[$i]);
+
+			if ($ordinal < 128)
+			{
+				$x[] = "|".$ordinal;
+			}
+			else
+			{
+				if (count($temp) == 0)
+				{
+					$count = ($ordinal < 224) ? 2 : 3;
+				}
+	
+				$temp[] = $ordinal;
+				if (count($temp) == $count)
+				{
+					$number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64);
+					$x[] = "|".$number;
+					$count = 1;
+					$temp = array();
+				}
+			}
+		}
+
+		$x[] = '<'; $x[] = '/'; $x[] = 'a'; $x[] = '>';
+
+		$x = array_reverse($x);
+		ob_start();
+
+	?><script type="text/javascript">
+	//<![CDATA[
+	var l=new Array();
+	<?php
+	$i = 0;
+	foreach ($x as $val){ ?>l[<?php echo $i++; ?>]='<?php echo $val; ?>';<?php } ?>
+
+	for (var i = l.length-1; i >= 0; i=i-1){
+	if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";");
+	else document.write(unescape(l[i]));}
+	//]]>
+	</script><?php
+
+		$buffer = ob_get_contents();
+		ob_end_clean();
+		return $buffer;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Auto-linker
+ *
+ * Automatically links URL and Email addresses.
+ * Note: There's a bit of extra code here to deal with
+ * URLs or emails that end in a period.  We'll strip these
+ * off and add them after the link.
+ *
+ * @access	public
+ * @param	string	the string
+ * @param	string	the type: email, url, or both
+ * @param	bool 	whether to create pop-up links
+ * @return	string
+ */
+if ( ! function_exists('auto_link'))
+{
+	function auto_link($str, $type = 'both', $popup = FALSE)
+	{
+		if ($type != 'email')
+		{
+			if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
+			{
+				$pop = ($popup == TRUE) ? " target=\"_blank\" " : "";
+	
+				for ($i = 0; $i < sizeof($matches['0']); $i++)
+				{
+					$period = '';
+					if (preg_match("|\.$|", $matches['6'][$i]))
+					{
+						$period = '.';
+						$matches['6'][$i] = substr($matches['6'][$i], 0, -1);
+					}
+		
+					$str = str_replace($matches['0'][$i],
+										$matches['1'][$i].'<a href="http'.
+										$matches['4'][$i].'://'.
+										$matches['5'][$i].
+										$matches['6'][$i].'"'.$pop.'>http'.
+										$matches['4'][$i].'://'.
+										$matches['5'][$i].
+										$matches['6'][$i].'</a>'.
+										$period, $str);
+				}
+			}
+		}
+
+		if ($type != 'url')
+		{
+			if (preg_match_all("/([a-zA-Z0-9_\.\-\+Å]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i", $str, $matches))
+			{
+				for ($i = 0; $i < sizeof($matches['0']); $i++)
+				{
+					$period = '';
+					if (preg_match("|\.$|", $matches['3'][$i]))
+					{
+						$period = '.';
+						$matches['3'][$i] = substr($matches['3'][$i], 0, -1);
+					}
+		
+					$str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str);
+				}
+			}
+		}
+
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Prep URL
+ *
+ * Simply adds the http:// part if missing
+ *
+ * @access	public
+ * @param	string	the URL
+ * @return	string
+ */
+if ( ! function_exists('prep_url'))
+{
+	function prep_url($str = '')
+	{
+		if ($str == 'http://' OR $str == '')
+		{
+			return '';
+		}
+
+		if (substr($str, 0, 7) != 'http://' && substr($str, 0, 8) != 'https://')
+		{
+			$str = 'http://'.$str;
+		}
+
+		return $str;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Create URL Title
+ *
+ * Takes a "title" string as input and creates a
+ * human-friendly URL string with either a dash
+ * or an underscore as the word separator.
+ *
+ * @access	public
+ * @param	string	the string
+ * @param	string	the separator: dash, or underscore
+ * @return	string
+ */
+if ( ! function_exists('url_title'))
+{
+	function url_title($str, $separator = 'dash')
+	{
+		if ($separator == 'dash')
+		{
+			$search		= '_';
+			$replace	= '-';
+		}
+		else
+		{
+			$search		= '-';
+			$replace	= '_';
+		}
+
+		$trans = array(
+						'&\#\d+?;'				=> '',
+						'&\S+?;'				=> '',
+						'\s+'					=> $replace,
+						'[^a-z0-9\-\._]'		=> '',
+						$replace.'+'			=> $replace,
+						$replace.'$'			=> $replace,
+						'^'.$replace			=> $replace
+					  );
+
+		$str = strip_tags($str);
+
+		foreach ($trans as $key => $val)
+		{
+			$str = preg_replace("#".$key."#i", $val, $str);
+		}
+
+		return trim(stripslashes($str));
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Header Redirect
+ *
+ * Header redirect in two flavors
+ * For very fine grained control over headers, you could use the Output
+ * Library's set_header() function.
+ *
+ * @access	public
+ * @param	string	the URL
+ * @param	string	the method: location or redirect
+ * @return	string
+ */
+if ( ! function_exists('redirect'))
+{
+	function redirect($uri = '', $method = 'location', $http_response_code = 302)
+	{
+		switch($method)
+		{
+			case 'refresh'	: header("Refresh:0;url=".site_url($uri));
+				break;
+			default			: header("Location: ".site_url($uri), TRUE, $http_response_code);
+				break;
+		}
+		exit;
+	}
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Parse out the attributes
+ *
+ * Some of the functions use this
+ *
+ * @access	private
+ * @param	array
+ * @param	bool
+ * @return	string
+ */
+if ( ! function_exists('_parse_attributes'))
+{
+	function _parse_attributes($attributes, $javascript = FALSE)
+	{
+		if (is_string($attributes))
+		{
+			return ($attributes != '') ? ' '.$attributes : '';
+		}
+
+		$att = '';
+		foreach ($attributes as $key => $val)
+		{
+			if ($javascript == TRUE)
+			{
+				$att .= $key . '=' . $val . ',';
+			}
+			else
+			{
+				$att .= ' ' . $key . '="' . $val . '"';
+			}
+		}
+
+		if ($javascript == TRUE AND $att != '')
+		{
+			$att = substr($att, 0, -1);
+		}
+
+		return $att;
+	}
+}
+
+
+/* End of file url_helper.php */
 /* Location: ./system/helpers/url_helper.php */
\ No newline at end of file
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index 83e2bb3..90cce3d 100644
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
@@ -1,62 +1,62 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 4.3.2 or newer
- *
- * @package		CodeIgniter
- * @author		ExpressionEngine Dev Team
- * @copyright	Copyright (c) 2008, EllisLab, Inc.
- * @license		http://codeigniter.com/user_guide/license.html
- * @link		http://codeigniter.com
- * @since		Version 1.0
- * @filesource
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * CodeIgniter XML Helpers
- *
- * @package		CodeIgniter
- * @subpackage	Helpers
- * @category	Helpers
- * @author		ExpressionEngine Dev Team
- * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
- */
-
-// ------------------------------------------------------------------------
-
-/**
- * Convert Reserved XML characters to Entities
- *
- * @access	public
- * @param	string
- * @return	string
- */	
-if ( ! function_exists('xml_convert'))
-{
-	function xml_convert($str)
-	{
-		$temp = '__TEMP_AMPERSANDS__';
-
-		// Replace entities to temporary markers so that 
-		// ampersands won't get messed up
-		$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
-		$str = preg_replace("/&(\w+);/",  "$temp\\1;", $str);
-	
-		$str = str_replace(array("&","<",">","\"", "'", "-"),
-						   array("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
-						   $str);
-
-		// Decode the temp markers back to entities		
-		$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
-		$str = preg_replace("/$temp(\w+);/","&\\1;", $str);
-		
-		return $str;
-	}
-}
-
-
-/* End of file xml_helper.php */
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package		CodeIgniter
+ * @author		ExpressionEngine Dev Team
+ * @copyright	Copyright (c) 2008, EllisLab, Inc.
+ * @license		http://codeigniter.com/user_guide/license.html
+ * @link		http://codeigniter.com
+ * @since		Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter XML Helpers
+ *
+ * @package		CodeIgniter
+ * @subpackage	Helpers
+ * @category	Helpers
+ * @author		ExpressionEngine Dev Team
+ * @link		http://codeigniter.com/user_guide/helpers/xml_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Convert Reserved XML characters to Entities
+ *
+ * @access	public
+ * @param	string
+ * @return	string
+ */	
+if ( ! function_exists('xml_convert'))
+{
+	function xml_convert($str)
+	{
+		$temp = '__TEMP_AMPERSANDS__';
+
+		// Replace entities to temporary markers so that 
+		// ampersands won't get messed up
+		$str = preg_replace("/&#(\d+);/", "$temp\\1;", $str);
+		$str = preg_replace("/&(\w+);/",  "$temp\\1;", $str);
+	
+		$str = str_replace(array("&","<",">","\"", "'", "-"),
+						   array("&amp;", "&lt;", "&gt;", "&quot;", "&#39;", "&#45;"),
+						   $str);
+
+		// Decode the temp markers back to entities		
+		$str = preg_replace("/$temp(\d+);/","&#\\1;",$str);
+		$str = preg_replace("/$temp(\w+);/","&\\1;", $str);
+		
+		return $str;
+	}
+}
+
+
+/* End of file xml_helper.php */
 /* Location: ./system/helpers/xml_helper.php */
\ No newline at end of file
